Skip to content

Instantly share code, notes, and snippets.

@msabramo
Created December 18, 2010 15:14
Show Gist options
  • Save msabramo/746585 to your computer and use it in GitHub Desktop.
Save msabramo/746585 to your computer and use it in GitHub Desktop.
Bash function and alias for evaluating Python expressions from the Bash command-line
_pyval() {
local python_cmd="print $@"
python -c "${python_cmd}"
case "$shopts" in
*noglob*) ;;
*) set +f;;
esac
unset shopts
}
alias pyval='shopts="$SHELLOPTS"; set -f; _pyval'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment