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
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
3 Comments
Bruce Adams
In general you need to be wary of version issues to avoid silent failures. Sometimes "#!env python2.7" or similar might be more appropriate.
vinz
That's true. And you should check for en.wikipedia.org/wiki/Shebang_(Unix) to clearly understand how shebang works.
Noctis Skytower
@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.