Skip to content

Instantly share code, notes, and snippets.

@io12
Created November 11, 2020 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save io12/3fc38c90edd86770d6cb608d11e0738e to your computer and use it in GitHub Desktop.
Save io12/3fc38c90edd86770d6cb608d11e0738e to your computer and use it in GitHub Desktop.
# run - replace the current terminal with a graphical program
# To install, source this file from your shell rc (or copy-paste it).
run() {
if ! command -v "$1" >> /dev/null; then
echo "run: error: command not found" 1>&2
return 1
fi
("$@" &)
exit
}
if command -v compdef >> /dev/null; then
# zsh completions
compdef _precommand run
elif command -v complete >> /dev/null; then
# bash completions
complete -F _command run
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment