>I am learning to do some bash programming on my new EmperorLinux lenovo T61
>(prideful plug) and am having a problem in attempting to determine if an
>argument was included when the bash file was started. I can perform a
printf
>statement and it prints whatever I add as an argument but I am attempting
to
>do an 'if/then' statement.
>
>desnotes@tardis:~# ./read_history.sh 15 #15 added as argument
>desnotes@tardis:~# ./read_history.sh #no argument
This works for me:
if [ "X"$1 = "X" ]
then
cnt=10
echo "no arg"
else
echo "Got an arg"
cnt=$1
fi
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://link.mail2web.com/mail2web
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:51:36 EDT