0

I essentially call a python script through an alias from the terminal:

 alias dos='python /path/to/script.py' .

This will run the python script.py in the current directory from where I launch it.

I would like to do something like that, from the terminal, for exaple:

dos 1 2 

so that the code will read the input values 1 and 2, and be able to assign their values to some variables in the code.

How is the proper way to do it?

  • Check out https://docs.python.org/3/library/argparse.html – JAV Oct 23 '20 at 17:25
  • Whether or not you use an alias to launch the script makes no difference at all for your actual question. A better solution is simply to make the script executable, make sure it has a valid shebang, and save it in a directory which is on your `PATH`. – tripleee Oct 23 '20 at 20:37
  • actually I am on mac, I don't know if it possible to do it like that. it is why I am using alias instead. – Andrea Angeletti Oct 24 '20 at 17:30

0 Answers0