GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Operating System  >  Shell Scripting
Go To First  |  Previous Question  |  Next Question 
 Shell Scripting  |  Question 24 of 47    Print  
What is this line in the shell script do ?#!/bin/ksh?

  
Total Answers and Comments: 6 Last Update: February 04, 2009     Asked by: Max 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Prakash Srinivasan
 
This line is called as "Hash Bang" Statement. This tells the OS that the particular needs the respective shell for execution. If a script file has this hash bang statement along with execution permission, then this file can be run directly without invoking thru shell command.Ex:$ instead of$ksh

Above answer was rated as good by the following members:
UncaAlby
June 22, 2006 19:43:22   #1  
Vijay        

RE: what is this line in the shell script do ???...
To invoke the shell indirectly this line is added as the first line in the file.This particular line invokes korn shell
 
Is this answer useful? Yes | No
July 04, 2006 08:11:58   #2  
soman        

RE: what is this line in the shell script do ???...

Hi

I want to get good bash shell interview questions for Linux system administrator.


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
July 19, 2006 04:02:06   #3  
Prakash Srinivasan        

RE: what is this line in the shell script do ???...
This line is called as Hash Bang Statement. This tells the OS that the particular needs the respective shell for execution. If a script file has this hash bang statement along with execution permission then this file can be run directly without invoking thru shell command.Ex:$ instead of$ksh
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 08, 2006 05:32:14   #4  
puneetkeswani Member Since: September 2006   Contribution: 2    

RE: what is this line in the shell script do ???...
the # actually is the comment which acan be used in the scripts. also // could alaso be used for the same indicating the comments. But when concerned with regards with script this ishow its is done. but its not executed anyways. The second character i.e. ! is an indication to execute any thing from the current location.For eg; if a vi editor is open and you want to run a command without exiting the editor that could be done ie.vi file1 (lets say)... the file is open now ... press the esc key then type : that is come to the commend promt type : !ls ..press enter ...you would be listing the files in the current directory.this is the purpose for the ! symbol in unix/linux shell./bin/ksh --tell that the parameters neccessary to execute the script could be found in this path.Also the specifics to be taken from the K shell i.e. the korn shell. this is because the user may be using the character specific parts of korn shell.If the line would have read some thing like this/bin/sh ...it would have taken the default shell ..in most cases the bash shellalthough this is more generic style for scriptingguys correct me if i went wrong somewhere.bye
 
Is this answer useful? Yes | No
March 28, 2007 07:23:33   #5  
Rahul        

RE: What is this line in the shell script do ?#!/bin/k...
It gives the environment or the shell in which your script would be run
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
February 04, 2009 06:14:53   #6  
ajit_saley Member Since: February 2009   Contribution: 5    

RE: What is this line in the shell script do ?#!/bin/ksh?
#! line states the interpreter to be used by the shell to interpret the script.

Here ksh interpreter is invoked for interpretation of the script.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape