Created
June 6, 2018 11:47
-
-
Save Kineolyan/95491fb81e265ccc23508cc325738159 to your computer and use it in GitHub Desktop.
Smart bash pipe keeping the last line
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
function t() { | |
for e in $(echo 'ab ac ad e bc bd e cd') | |
do | |
echo $e | |
sleep 1 | |
done | |
} | |
t | while read line; | |
do | |
if [[ $line == e ]] | |
then | |
echo "-- new line --" | |
else | |
echo -en " -> $line\r" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment