Created
November 11, 2020 04:14
-
-
Save io12/3fc38c90edd86770d6cb608d11e0738e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# 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