-
-
Save nelaaro/593bf8d705b82df0d066e4d7e6b5c1d2 to your computer and use it in GitHub Desktop.
Bash pipe tail file while loop read line
This file contains 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 | |
# read from stdin | |
while read line | |
do | |
echo "$line" | |
done < "${1:-/dev/stdin}" | |
# read from file | |
while read line | |
do | |
echo "$line" | |
done < <(tail -f data.txt) | |
# read from file also | |
tail -f data.txt | while read line | |
do | |
echo "$line" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment