[clug] shell stdout and stderr

Tony and Robyn Lewis beakysnugger at yahoo.co.uk
Thu Dec 1 04:33:12 GMT 2005


Cameron Patrick wrote:

>Try this, e.g.:
>   exec >stdout_file 2>stderr_file <stdin_file
>
>  
>
Thought of that, but that would require either a second script that the 
first one execs, or re-executing myself (recursion) so I would end up 
with (gasp) inelegance like:


if $DONTRECURSE
then
    /run/my/dodfy/commands
else
    DONTRECURSE=1 exec $* 2> /tmp/mystderr
fi

Just trying to avoid the messiness of this and twice as many shells 
running as I really need.

Tony



More information about the linux mailing list