The best way to capture the output of a file itself in unix The best way to capture the output of a file itself in unix unix unix

The best way to capture the output of a file itself in unix


The example you gave using curly brackets works just fine exactly the way you posted it.

Another way is adding literally exec > output.txt as the second line (after the shebang) in your script. All subsequent output in the script will be redirected to the file.