What are the steps required to make a script executable on Unix?
Answer Posted / chaitanya
The steps that are required to make a script executable are to:
• First create a script file and write the code that has to be executed in it.
• Make the file mode as executable by making the first line starts with #! this is the line that python interpreter reads.
• Set the permission for the file by using chmod +x file. The file uses the line that is the most important line to be used:
#!/usr/local/bin/python
• This explains the pathname that is given to the python interpreter and it is independent of the environment programs.
• Absolute pathname should be included so that the interpreter can interpret and execute the code accordingly. The sample code that is written:
#! /bin/sh
# Write your code here
exec python $0 ${1+"$@"}
# Write the function that need to be included.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is asynchronous python?
Write program to validate the email address in python?
What command do we use to debug a python program?
Explain important characteristics of python objects?
How do you append to a list in python?
How can you generate random numbers in python?
What’s your preferred text editor?
What happens in the background when you run a python file?
How do you sort a list alphabetically in python with sort function?
What animal sleeps the most?
What is raw_input in python 3?
Explain garbage collection in python?
Explain split() methods of "re" module in python?
How to comment multiple lines in python?
What are the 3 types of loops?