I want to test for a command line argument within an alias ...
alias mb3='if [[ -z $1 ]];\
then\
echo "yes";\
else\
echo "no";\
fi;\
echo $1'
It doesn't seem to recognize the $1 in the if stmt (I always get "no"), but it does recognize it in the echo stmt.
I've tried escaping the 1st $1 (i.e. - \$1) to no avail.
Can this be done?
example ...
> mb3
> no
>
> mb3 abc
> no
> abc
alias mb3='if [[ -z $1 ]];\
then\
echo "yes";\
else\
echo "no";\
fi;\
echo $1'
It doesn't seem to recognize the $1 in the if stmt (I always get "no"), but it does recognize it in the echo stmt.
I've tried escaping the 1st $1 (i.e. - \$1) to no avail.
Can this be done?
example ...
> mb3
> no
>
> mb3 abc
> no
> abc