if else bash or code example
Example: 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
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