1

I am trying to make an application that will work from the command line. For instance application -h. So I put a bash script in my /usr/local/bin/ that does cd /path/to/application Then on the next line ./Main.py. But if I execute the command it it doesn't receive the -h. However if I do an alias in my .bashrc with the same commands it works just fine. How could I change the bash script to work with parameters? And why does the alias work but not the script?

closed as unclear what you're asking by Android Dev, wjandrea, user364819, RPiAwesomeness, Eric Carvalho May 20 '17 at 19:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Examples and contents of the bash script would help! – George Udosen May 20 '17 at 13:46
5

Because shell script has no way of knowing that you want to pass arguments to your Python script. Use

./Main.py "$@"

Also don't use cd. It's redundant. Just use full path to ./Main.py , or even better avoid having a wrapper script altogether, unless necessary. Just put ./Main.py into one of the directories that are part of your $PATH variable and call your Python script directly.

The main point is that what you're trying to do is probably wrong and unnecessary, and there are better ways to do it

Not the answer you're looking for? Browse other questions tagged or ask your own question.