问题
I want to check if the user has given the script any arguments and if this is the case, the script should close.
if [ $@ = "" ]; then
exit
fi
is not working.
回答1:
You can try like this,
if [ "$#" -eq 0 ]; then
echo "Illegal number of parameters"
fi
来源:https://stackoverflow.com/questions/34925224/how-can-i-check-if-no-arguments-are-given