Skip to content

Instantly share code, notes, and snippets.

@bhyde
Created November 18, 2014 18:31
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 bhyde/a51273d161ac08515dff to your computer and use it in GitHub Desktop.
Save bhyde/a51273d161ac08515dff to your computer and use it in GitHub Desktop.
A clever scheme to indent shell output, which doesn't work :(
#!/bin/bash
function indent(){
exec 6>&1
exec > >(sed 's/^/ /')
}
function end_indent(){
exec 1>&6 6>&-
}
echo one
indent
echo two
end_indent
echo three
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment