Created
August 2, 2018 06:17
-
-
Save miguelmota/5417fad9c1162ad0c4fa2a5e6e134457 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