On Sun, 1 Feb 2004, dpblue wrote:
> Hi all.
>
> I'm Brazilian and my english aren't good. I hope that u
> understand me.
>
> I think that i found a serious bug in bash.
>
> i've made this stupid script:
>
> --------------------------------
> #!/bin/bash
>
> if $0 == $1 ; then
> echo "HELLO"
> fi
> --------------------------------
>
> (i dont know if this sintax are correct)
The argument to "if" is interpreted as a command. In this case the
argument, $0, is the name of the script, so the script calls
itself, then calls itself, then calls itself, then calls itself,
then calls itself, then calls itself, then calls itself.........
ad infinitum, ad nauseam......
What you probably want is:
if [ "$0" = "$1" ]
then
echo "HELLO"
fi
--
Chris F.A. Johnson
=================================================================
cfaj@freeshell.org http://cfaj.freeshell.org