0

I have a python script which I call from the terminal like:
python myscript.py arg1 arg2 arg3

Now I want to create a Makefile which will allow calling
./myscript arg1 arg2 arg3
to do the same as the first command, but I'm not sure how to do this (mostly because of the additional command line args). How do I write this Makefile?

3
  • Are you using bash or batch? (Windows vs. UNIX). Commented Jan 18, 2017 at 2:33
  • using bash, sorry I forgot to mention that Commented Jan 18, 2017 at 15:32
  • Then yes you can just use chmod or make a bash file with the contents of python FILENAME.py $1 $2 $3. Now you can run ./myscript arg1 arg2 arg3 and it will run python FILENAME.py arg1 arg2 arg3. Now you just do a "make file" within python. Commented Jan 18, 2017 at 21:00

1 Answer 1

1

Include your python path on the first line of your myscript.py

#!/usr/bin/python

Then make your script executable

chmod +x myscript.py

You can rename myscript.py to myscript if you will.

Now you can run it the way you wanted.

Sign up to request clarification or add additional context in comments.

1 Comment

Useful advice, but unfortunately I was told I needed to use a makefile.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.