我想给我的Bash脚本添加一个命令,将所有的stderr和stdout都定向到特定的文件中。从这里和其他许多来源得知,我知道在命令行中我会使用:
/path/to/script.sh >> log_file 2>> err_file
不过,在我的脚本中,我希望有类似于这些 slurm 标志的东西:
#!/bin/bash
#SBATCH -o slurm.stdout.txt # Standard output log
#SBATCH -e slurm.stderr.txt # Standard error log
<code>
是否有一种方法可以在脚本内直接输出,或者每次调用脚本都需要使用 >> log_file 2>> err_file
?谢谢