1

I have a python program called myresolver.py, which takes 1 command line argument. I want this python program to run like ./myresolver argument_name. Can I please know how to do this? Any help is greatly appreciated. Thanks.

1 Answer 1

3

simply add the correct shebang at the beginning of your myresolver.py file:

#!/usr/bin/python

and add the executable flag to the file:

$ chmod a+x myresolver.py
$ ./myresolver.py argument_name
Sign up to request clarification or add additional context in comments.

3 Comments

In general you need to be wary of version issues to avoid silent failures. Sometimes "#!env python2.7" or similar might be more appropriate.
That's true. And you should check for en.wikipedia.org/wiki/Shebang_(Unix) to clearly understand how shebang works.
@Sakshi If this answer was suitable for solving your problem, you may want to mark it as being accepted (the check mark underneath the votes up and down that this question has received). It is a quick way for others to identify that this answer is to be prefered over any others that might show up in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.