Anjan1
1
Hi,
I need the data to be appended to the file using exec command in linux.
I am able to add the data to a file using exec command but the file is getting overwritten.
Above exec command is used to overwite in a file.
When I use "exec >>& fileName", getting "syntax error near unexpected token `&' and `exec >>& capture.txt'"
Please someone tell me how to append to a file using exec command.
Assuming you are not using a csh-derived shell, then:
exec >> filename
Anjan1
3
I want the errors occured in a script should be appended to the file using exec command.
when i run
, errors are displaying in STDOUT.
I want errors to be appended to a file(say log file).
Then just redirect just STDERR:
exec 2>> filename
or if both STDOUT and STDERR:
exec >> filename 2>&1
or if using bash:
exec &>> filename
These are detailed in the man bash (linux) and man ksh (linux) manual pages under 'redirection'