[clug] shell stdout and stderr
Peter Barker
pbarker at barker.dropbear.id.au
Thu Dec 1 05:18:07 GMT 2005
On Thu, 1 Dec 2005, Tony and Robyn Lewis wrote:
> script (simple redirection), but not if something generates an error
> within the log wrapper, such as being unable to find / execute the
> target script/
>
> Clear? Good.
OK, this isn't precisely what you wanted, and you've already said that
"exec" isn't for you.
But it's closer, and functions are good :)
You can redirect the output of functions in bash:
----
#!/bin/sh
function dostuff() {
echo "bob";
bob
}
dostuff >bill.out 2>bill.err
----
So encapsulating everything in a function call might be an option you
could consider.
> Pointers appreciated.
This things are always interesting. I just spotted the "we treat
/dev/tcp/<host>/<port> specially" bit in the bash redirection stuff. Handy
if you've no netcat.
> Tony
Yours,
--
Peter Barker | N _--_|\ /---- Barham, Vic
Programmer,Sysadmin,Geek | W + E / /\
pbarker at barker.dropbear.id.au | S \_,--?_*<-- Canberra
You need a bigger hammer. | v [35S, 149E]
"Peter is apathetic, and I'm vaguely apathetic" -- Rachel, thinking of organising a movie trip
More information about the linux
mailing list