here is a small script:
if [ $# -lt 1 ]; then
echo please enter an argument
fi
if [ "$1" = "tom"; then
a=$1
echo $a
fi
here is my question. if the script name is j.sh and I run it : j.sh from shell prompt: without a parameter: it prints please enter an argument but if I go with . j.sh (current shell execution): it does not show that.
also if I go with an argument $ j.sh tom or $ . j.sh tom
the result is identical. however the next time I go with no argument, still I see the variable has a value tom with $ . j.sh tom. what makes the current shell execution keep the variable to value assigned even if on the next trun no argument is passed.
any suggestion would be highly appreciated.
thanks.