I pasted python code inside a bash script like this:
#!/bin/bash echo "You are in Bash" python <<END # -*- coding: utf-8 -*- import os import sys import getpass print "You are in python" username=raw_input('Bitbucket Username : ') END echo "Python ended"
But the problem is that I cannot accept data using raw_inputor inputwhen I embed python in bash. Only Python works fine. What is the problem in my code?
raw_input
input
Instead of heredoc, simply enter the parameter -cto pass the command:
-c
$ python -c "username = raw_input('Enter name: ') print 'Hello', username " Enter name: Chris Hello Chris
END, bash, . bash Python. python, , , , , EOF Ctrl-D linux, Ctrl-Z . , raw_input() EOFError. , bash. Python , : " . EOF". , . , . , , , , Python ... -. KeyboardInterrupt, .
END
EOF
raw_input()
EOFError