Script with one argument to execute the further commands
if [ $# -ne 1 ]
then
echo "Write your comments"
exit -1 # exit the script
fi
$# stands for the number of arguments, it is number.
In if command you can change ne (not equal) to other comparing operator according to the requirements.
lt = Less than.
gt = Greater than.
le = Less than or equal.
ge = Greater than or equal.
eq= Equals.
if [ $# -ne 1 ]
then
echo "Write your comments"
exit -1 # exit the script
fi
$# stands for the number of arguments, it is number.
In if command you can change ne (not equal) to other comparing operator according to the requirements.
lt = Less than.
gt = Greater than.
le = Less than or equal.
ge = Greater than or equal.
eq= Equals.