Re: [PATCH] Trapping exit in tests, using return for errors

From: Junio C Hamano <junkio@cox.net>
Date: 2005-08-11 16:22:54
Sorry, sent it out without finishing.  The worst is "return".
With ksh, ash, and dash, the script itself exits with status
code 1 (presumably you are trapping it with trap -- exit,
though).

prompt$ bash k.sh exit
foo
prompt$ bash k.sh false
foo
status 1
prompt$ bash k.sh return
foo
k.sh: line 20: return: can only `return' from a function or sourced script
status 1
prompt$ ash k.sh exit
foo
prompt$ ash k.sh false
foo
status 1
prompt$ ash k.sh return
foo
prompt$ ksh k.sh exit
foo
prompt$ ksh k.sh false
foo
status 1
prompt$ ksh k.sh return
foo

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Aug 11 16:42:58 2005

This archive was generated by hypermail 2.1.8 : 2005-08-11 16:43:00 EST