function in if statement bash code example
Example 1: bash if with function call
#don't use [[ (or [) when running a command and checking the result code
if is_magento_root_dir $SOURCE_DIR ;then
#code here
fi
Example 2: bash if statement
and - &&
or - ||
# and example
if [ -r $1 ] && [ -s $1 ]
then
echo This file is useful.
fi
# or example
if [ $USER == 'bob' ] || [ $USER == 'andy' ]
then
ls -alh
else
ls
fi