Skip to content

Instantly share code, notes, and snippets.

@dualbus
Created March 28, 2014 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dualbus/9837606 to your computer and use it in GitHub Desktop.
Save dualbus/9837606 to your computer and use it in GitHub Desktop.
#!/bin/sh
log_file=$1
reopen() {
exec > "$log_file" 2>&1
}
trap reopen HUP
reopen
while IFS= read -r line; do
printf '%s\n' "$line";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment