-
-
Save shawalli/42bfabebc5ee8bf197ce0ac7b2c1543a to your computer and use it in GitHub Desktop.
'Watch' command as a bash script.
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 | |
# This script *should* work on *nix and Windows, but was designed specifically for git-bash on Windows, to fill the watch gap. | |
clear | |
if [ "$#" -gt "2" ] && [ "-n" == "${1:0:2}" ]; then | |
time=$(echo $1 | sed -e 's/-n//') | |
shift | |
watchedcmd=$@ | |
else | |
time="5" # Saneish default | |
watchedcmd=$@ | |
fi | |
while true; do | |
clear | |
echo "Watching \"${watchedcmd}\" - refreshing every ${time} seconds" | |
${watchedcmd} | |
sleep ${time} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment