What are the steps required to make a script executable on Unix?



What are the steps required to make a script executable on Unix?..

Answer / 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

More Python Interview Questions

What is the process of compilation and loading in python?

0 Answers  


What are the advantages of python?

0 Answers  


What is pass in python? What are the differences between pass and continue?

0 Answers  


How can we make a executable file with python script?

0 Answers  


How can you access a session in flask?

0 Answers  






Who built the sphinx?

0 Answers  


What is the use of globals() function in python?

0 Answers  


How to use *args and **kwargs in python?

0 Answers  


What is the parameter passing mechanism in Python?

0 Answers  


What is s in python 3?

0 Answers  


What is a docstring?

0 Answers  


What is jinja python?

0 Answers  


Categories