Skip to content

Instantly share code, notes, and snippets.

@albertomm
Created December 27, 2018 15:53
Show Gist options
  • Save albertomm/ffd0239a2309c10f681b7cb83dd42789 to your computer and use it in GitHub Desktop.
Save albertomm/ffd0239a2309c10f681b7cb83dd42789 to your computer and use it in GitHub Desktop.
Redirect all the script output to a file
#!/bin/bash
# Log all output to a file
exec > >(tee -ia "$0.log") 2>&1
echo "This will be logged."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment