Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Created June 18, 2017 00:40
Show Gist options
  • Save ryaan-anthony/bf62c3d8af80d6b9ef1f71045d6bfcd4 to your computer and use it in GitHub Desktop.
Save ryaan-anthony/bf62c3d8af80d6b9ef1f71045d6bfcd4 to your computer and use it in GitHub Desktop.
#!/bin/bash
while read -p "> " line; do
if [[ $line == "log" ]]; then
exec >>log 2>&1
fi
echo $line
exec &>$(tty)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment