Replace the shell with a command
medium risk
`exec cmd` runs cmd in place of the shell. `exec >file` redirects the whole script’s output.
exec bash -lRestart your shell · explain & risk-check →exec > >(tee out.log) 2>&1Log everything the script prints · explain & risk-check →Reference text is hand-written and may be incomplete — check man exec for your version. Test destructive commands on a non-production system first.