Skip to content

Instantly share code, notes, and snippets.

@friek
Created July 9, 2015 08:48
Show Gist options
  • Select an option

  • Save friek/2cdccea2701a6c6f96d4 to your computer and use it in GitHub Desktop.

Select an option

Save friek/2cdccea2701a6c6f96d4 to your computer and use it in GitHub Desktop.
bash prefix stdout/stderr of command output
#!/bin/bash
# Case 1: prefix stdout with 'test'
exec 1> >(sed 's/^/test /')
# Case 2: prefix a group of commands with 'test'
{
echo "prefixed line"
} > >(sed 's/^/test /')
@reduardo7
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment