Skip to content

Instantly share code, notes, and snippets.

@aal89
Last active December 17, 2019 16:34
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 aal89/58e254efeb0fca76db6daa521fec40f9 to your computer and use it in GitHub Desktop.
Save aal89/58e254efeb0fca76db6daa521fec40f9 to your computer and use it in GitHub Desktop.
Profile alias to quickly execute Python scripts from anywhere on some random path with regard to sys.argv, for *nix systems. Alias gp stands for globalpython.
alias gp='function __gp() { (python3 ~/Documents/python/$1.py $(shift;printf "$*") 2>/dev/null) || echo "File not found or errors occurred."; unset -f __gp; }; __gp'
# (assumption hiworld.py is an actual file)
#
# usage: gp hiworld
# usage: gp sub/dir/hiworld arg0 arg1
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment