There are several alternatives to execute python code from commandline. The one I prefer is n.1, but check them out all:
echo -e "import sys\nfor r in range(10): print 'rob'" | python
or w/out pipes:
python -c "exec(\"import sys\\nfor r in range(10): print 'rob'\")"
or
(echo "import sys" ; echo "for r in range(10): print 'rob'") | python
No comments:
Post a Comment