Skip to content

Instantly share code, notes, and snippets.

@cinatic
Created October 6, 2023 09:20
Show Gist options
  • Save cinatic/5e54a87a1bef019fe1848e00c2bf86f1 to your computer and use it in GitHub Desktop.
Save cinatic/5e54a87a1bef019fe1848e00c2bf86f1 to your computer and use it in GitHub Desktop.
watch function with expanded alias
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