04-29-05 01:09 PM
On Fri, 29 Apr 2005 at 05:55 GMT, absinth wrote:
> Can someone help me with this in KSH and tell me why the exit status is
> not returned?
>
> Why is "haha" printed?
Because the command (local) succeeded.
> #!/bin/ksh
>
> getNoGlobalProc()
> {
> local a=`ls sdfafa`
>
> if [[ $? -ne 0 ]]; then
> echo "$SCRIPTNAME : $LINENO : Could not obtain global number of
> processes running"
> return 1
> fi
>
> echo "haha"
>
> return 0
> }
>
> getNoGlobalProc
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
========================================
==========================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/ssr.html>
[ Post a follow-up to this message ]
|