Skip to content

Instantly share code, notes, and snippets.

@olivierlemoal
Last active April 14, 2020 17:10
Show Gist options
  • Select an option

  • Save olivierlemoal/4a60d174ad6962b5c095 to your computer and use it in GitHub Desktop.

Select an option

Save olivierlemoal/4a60d174ad6962b5c095 to your computer and use it in GitHub Desktop.
Pipe reader
#!/bin/bash
# Quick n dirty pipe reader
pipe=/tmp/p
trap "rm -f $pipe" EXIT
if [[ ! -p $pipe ]]; then
mkfifo $pipe
fi
while true
do
if read line <$pipe; then
printf "%s\n" "$line"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment