Running Python and Shell scripts in Terminal, and passing arguments
In the Python script
Asserting because passed arguments in terminal are only considered texts. The first argument sys.argv[0]
is reserved to the file name itself and can't be used or assigned.
In the shell script
Shell files doesn't take arguments names, only their position, and they need to be declared with the dollar sign beforehand. The first argument can't be reassigned, it's reserved to the .sh file name itself.
What to run in iTerm
Here I called the .sh file I need, and passed two arguments to it that are taken in the Python script in it.
Important: use source
not sh
to run the .sh script, that will save you a ton of headache like I had; if you run sh
it won't execute the conda commands and will error out, you need source
for that.
☞ Instructions on how to download and customize iTerm are on a dedicated page for that.
Last updated