I am very new to shell scripting, so I'm still figuring things out. Here is my problem:
I have a python .py executable file which creates multiple files and saves them to a directory. I need to run that file in a shell script. For some reason, the shell script executes the python script but no new files appear in my directory. When I just run the .py file, everything works fine
Here's what my shell script looks like:
#!/bin/bash cd /home/usr/directory python myfile.py Within my python script, the files that are saved are pickled object instances. So every one of them looks something like this:
f = file('/home/usr/anotherdirectory/myfile.p','w') pickle.dump(myObject,f) f.close()
myfile.pyreside in/home/usr/directory? I know the level of stupidity on this one, just making sure. Also there should be no space between#!and/bin/bash:) And if you think you need the bash script for running this as a cron or a part of a installation process, just add#!/usr/bin/pythonto the top of your script andchmod +x myfile.pyand you can execute it just like it would be a bash-script :)