Problem Statement
How do you log output from a shell script for future reference?
Explanation
You can redirect both standard output and error to a log file using > and 2> operators.
For example, script.sh > output.log 2>&1 saves all messages, making debugging easier later.
Code Solution
SolutionRead Only
./deploy.sh > deploy.log 2>&1
Practice Sets
This question appears in the following practice sets: