Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python code in bash script

*2 Example of the dangers of temp files. DO NOT USE THIS CODE

cat >/tmp/python-script <<END
for i in range(10):
    print(i)
END
python /tmp/python-script
If someone else creates /tmp/python-script first, this shell script won't even stop if it fails to overwrite the file. A malicious user on the system could make a harmful Python script which will run instead of the intended script.
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #python #code #bash #script
ADD COMMENT
Topic
Name
7+7 =