Created
October 6, 2023 09:20
-
-
Save cinatic/5e54a87a1bef019fe1848e00c2bf86f1 to your computer and use it in GitHub Desktop.
watch function with expanded alias
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
watch1 (){ | |
firstArg=$1 | |
shift; | |
rest=$@ | |
resolvedCmd=$(alias $firstArg 2>/dev/null | cut -d\' -f2) | |
if [ -z "$resolvedCmd" ]; then | |
resolvedCmd=$firstArg | |
fi | |
watch -n 1 "$resolvedCmd $rest" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment