Skip to content

Instantly share code, notes, and snippets.

@erkiesken
Created April 22, 2016 12:52
Show Gist options
  • Save erkiesken/fac3ff21316670dca160a4d916dfd6f7 to your computer and use it in GitHub Desktop.
Save erkiesken/fac3ff21316670dca160a4d916dfd6f7 to your computer and use it in GitHub Desktop.
Bash script output to stdout and teed to a file
#!/bin/bash
set -exuo pipefail
# Taken from https://alestic.com/2010/12/ec2-user-data-output/
exec > >(tee ./tmp.log) 2>&1
echo BEGIN
ls -lah .
echo END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment