I want to add a command to my bash script that directs all stderr and stdout to specific files. From this and many other sources, I know that from the command line I would use:
/path/to/script.sh >> log_file 2>> err_file
However, I want something inside my script, something akin to these slurm flags:
#!/bin/bash
#SBATCH -o slurm.stdout.txt # Standard output log
#SBATCH -e slurm.stderr.txt # Standard error log
<code>
Is there a way to direct output from within a script, or do I need to use >> log_file 2>> err_file
every time I call the script? Thanks