Reputation: 3
The command
perl myperlscript.pl > output.txt 2>&1
is redirecting output to the file. But it is overriding the file every time. How to append the text to the end of existing file?
Upvotes: 0
Views: 553
Reputation: 141
To append, you can use >>
instead of >
.
In your case, the new command will be:
perl myperlscript.pl >> output.txt 2>&1
2>&1
is redirecting the stderr to stdout (the output of stderr will also be saved in output.txt
), so you don't need >>
there.
Upvotes: 1