I'm trying to create a shell script (e.g., test.sh) that executes multiple commands, and redirect each command's stdout and stderr to a specific log file.
But, if a command fails, after writing stderr to the log file, I want to abort, rather than continuing with the remaining commands.
Will the following work, or do I need to do something different?
command1 > log1.txt 2>&1
command2 > log2.txt 2>&1
command3 > log3.txt 2>&1