Last active
April 14, 2020 17:10
-
-
Save olivierlemoal/4a60d174ad6962b5c095 to your computer and use it in GitHub Desktop.
Pipe reader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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