Evgenij Shkrigunov wrote:
> Description:
> Failed trap ERR inside function. Below is an example of script(see comments):
>
> #!/bin/bash -E
>
> err_print() {
> RETVAL=$?
> echo "Nonzero exit: $RETVAL"
> echo "file: ${BASH_SOURCE[0]}"
> echo "line: ${BASH_LINENO[0]}"
> }
>
> trap err_print ERR
>
>
> failed_func(){
> # false must be ignored becose &&
> # but ...
> false && echo ""
> }
>
> # false must be ignored becose &&
> false && echo ""
>
> failed_func
The ERR trap is inherited by the function and ignored. The simple command
that fails and causes the ERR trap to be run is the call to `failed_func'
itself. This would be clearer if you added `echo after' as the last
command in the body of `failed_func'.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/