[KLUG Members] getting exit code in bash script
bill
bill at billtron.com
Fri Mar 11 12:21:13 EST 2005
I tried this:
#!/bin/sh
ls
exitcode=$?
if [ $exitcode -eq 0 ]
then
#echo "Everything is O.K."
else
#echo "$exitcode"
fi
and still get errors:
./testexitcode.sh: line 9: syntax error near unexpected token `fi'
./testexitcode.sh: line 9: `fi'
On Fri, 2005-03-11 at 11:41, Bruce Smith wrote:
> #!/bin/sh
> somecommand
> exitcode=$?
> if [ $exitcode -eq 0 ]
> then
> echo "Everything is O.K."
> else
> echo the exit code for somecommand was: $exitcode
> fi
>
> > How can I get the exit code in a bash script?
> >
> > I'm using
> >
> > if [ $? -eq 0 ]
> > then
> > echo "Everything is O.K."
> > else
> >
> > # want to get exit code here
> > fi
>
>
> _______________________________________________
> Members mailing list
> Members at kalamazoolinux.org
>
>
>
More information about the Members
mailing list