Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is there a switch or case statement in python? If not then what is the reason for the same?

756


Write a program to convert all strings in list to integers?

788


What do you understand by monkey patching in python?

821


Has python has monkey patching concept within?

829


How do you make hello world in python?

849


How can I find methods or attributes of an object in Python?

816


find max length of any given sublist?

837


How to reload a python module?

891


What is the purpose of "self" in python

947


How would you perform unit-testing on your python code?

799


What is set type in python?

775


How python can be used in software testing?

895


What is the iterator protocol?

846


How do you disconnect from the database?

923


What does the *args do in python?

802