Subject: Re: Re: [ast-users] typo in my last message
--------

In my last mesage I wrote.
> Subject: typo in my last message 
> --------
> 
>        your_long_command & pid
>        if [[ ! $BgFlag  ]] && wait $pid
> 
> should have been
>        your_long_command & pid=$!
>        if [[ ! $BgFlag  ]] && wait $pid
> 
> Also long as there is only one background job, you could simplify as
>        your_long_command &
>        if [[ ! $BgFlag  ]] && wait $!
> 


However, I must still have been asleep.  The 'if' doesn't belong.

Also, since [[...]] is not in the original Bourne shell,
        your_long_command &
        case $BgFlag in
        y*)     ;;
        *)      wait $!;;
        esac

should work in all shells with the following caveat.

With the original Bourne shell, if the background job completes before the
wait command, the exit status could get lost.

POSIX conforming shells are required to return the exit status
even if the background job completes before the wait.

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to