Last active
December 12, 2015 12:38
-
-
Save dbyler/4773203 to your computer and use it in GitHub Desktop.
Executes cat, then tail -f
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
cattail() { | |
if [ ! $1 ]; then | |
echo "usage: cattail 'string' file" | |
else | |
grep "$1" $2 | |
tail -f -n 0 $2 |grep "$1" | |
fi | |
} | |
alias ct=cattail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those wondering, the name came out of using
cat $FILE |grep $STRING
instead ofgrep "$STRING" $FILE
because it's easier to just arrow up and changecat
totail -f
than restructure the command.(Not that I needed to explain myself; there's more than one way to skin a cat...)