#!/bin/bash
if ["$1" == ""]
then
echo "A"
echo "B"
fi
what is the meaning of dollar sign with one number equal double quotation in this case ? ("$1" == "")
#!/bin/bash
if ["$1" == ""]
then
echo "A"
echo "B"
fi
what is the meaning of dollar sign with one number equal double quotation in this case ? ("$1" == "")
["$1" == ""]
, if written correctly as [ "$1" == "" ]
or [ "$1" = "" ]
, in this case tests if the first argument supplied to the script is empty. Thus, the script will print 'A' and 'B' if it is run without arguments (e.g. ./script.sh
) or with an empty argument (e.g. ./script.sh ""
).