Created
October 8, 2012 14:24
-
-
Save flagranterror/3852795 to your computer and use it in GitHub Desktop.
'Watch' command as a bash function.
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
# I miss 'watch' on OS X | |
watch () { | |
clear | |
if [ -z $2 ] | |
then | |
time="5" # Saneish default | |
watchedcmd=$1 | |
else | |
time=$(echo $1 | sed -e 's/-n//') | |
watchedcmd=$2 | |
fi | |
while true; do echo "Watching ${watchedcmd} - refreshing every ${time} seconds" ; ${watchedcmd} ; sleep ${time} ;clear; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment