|
From: kk_oop on 7 Mar 2006 07:26 Hi. I am using a Bourne script like this: myscript.sh >& myoutput.out Instead of doing this, is there a command I can put inside my script to cause it to redirect output in this way? Thanks! Ken
From: Stephane Chazelas on 7 Mar 2006 07:31 On 7 Mar 2006 04:26:57 -0800, kk_oop(a)yahoo.com wrote: > Hi. I am using a Bourne script like this: > > myscript.sh >& myoutput.out > > Instead of doing this, is there a command I can put inside my script to > cause it to redirect output in this way? [...] #! /bin/sh - exec > myoutput.out 2>&1 # the remaining of your script goes here or #! /bin/sh - { # your script goes here } > myoutput.out 2>&1 Note that if myoutput.out can't be open for writing, the script will stop at once and not do anything (which is probably what you want). -- Stephane
|
Pages: 1 Prev: How to run a exe file in Unix shell script? Next: fixed-size records |