1834431 Members
2394 Online
110067 Solutions
New Discussion

Re: A Script Problem

 
ericfjchen
Regular Advisor

A Script Problem

Can you kindly explain the following meaning?
==========
exec 2>> /tmp/informixbk 1>&2
==========

Thanks

Eric
4 REPLIES 4
H.Merijn Brand (procura
Honored Contributor

Re: A Script Problem

From this point on, redirect all output from stderr (2) and stdout (1) to be appended (>>) to file /tmp/informixbk


Enjoy, have FUN! H.merijn
Enjoy, Have FUN! H.Merijn
Trond Haugen
Honored Contributor

Re: A Script Problem

1>&2 redirects all standard out to standard error.
exec 2>> /tmp/informixbk sends/appends all standard errors to the file from now on.

The two send all output to the file.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
T G Manikandan
Honored Contributor

Re: A Script Problem

exec is used to avoid creating new process,
then it specifies that redirect the output and error messages into /tmp/informixbk
Muthukumar_5
Honored Contributor

Re: A Script Problem

exec command without any argument will modify file descriptors as prescribed by the input/output redirection list.

exec 2>> /tmp/informixbk 1>&2 means,

Current shell's input and output will be redirected , appended to /tmp/informixbk there.

>> - appends to a file

Try to check as,
exec 2>> /tmp/informixbk 1>&2 &
so that it will be running in background there.

exec hostname;hai 2>> /tmp/informixbk 1>&2 &
Easy to suggest when don't know about the problem!