The UNIX Forums  

Go Back   The UNIX Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Answers to Frequently Asked Questions Please look in here before posting your questions.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 11:00 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 09:52 PM
how could i make a program mixed with many "|", "<" and ">" strugglingman High Level Programming 2 04-29-2006 05:11 AM
No utpmx entry: you must exec "login" from lowest level "shell" peterpan UNIX for Dummies Questions & Answers 0 01-18-2006 12:15 AM
how to request a "read" or "delivered" receipt for mails plelie2 Shell Programming and Scripting 1 08-06-2002 12:26 PM

 
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-11-2002
Registered User
 

Join Date: Jun 2002
Location: Chennai, India
Posts: 110
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Cool What does "#! /usr/bin/ksh" mean?

Whenever we write a shell script the first statement would be #! /usr/bin/ksh or something of the same..

What does this signify??? I know # is a comment.. what is this ! for???

Give in your thoughts....


Thanks,
Nisha
Forum Sponsor
  #2 (permalink)  
Old 07-11-2002
Registered User
 

Join Date: Jul 2002
Location: void
Posts: 53
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
It's to tell your shell what shell to you in executing the following statements in your shell script.
  #3 (permalink)  
Old 07-11-2002
Registered User
 

Join Date: Jun 2002
Location: Chennai, India
Posts: 110
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Question

is that all hell666??????
  #4 (permalink)  
Old 07-11-2002
Registered User
 

Join Date: Jul 2002
Location: void
Posts: 53
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Yes, that is it. But, this kind of comment should be in your first line of the script, only then does it take this form. Also, when your shell comes across this line, a new process is spawned and replaced with this shell of your choice, and it is this process which will parse your script.
  #5 (permalink)  
Old 07-12-2002
killerserv's Avatar
Unix Predator
 

Join Date: Dec 2000
Location: Phoenix, AZ
Posts: 670
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
On the first line of an interpreter script, the "#!", is the name of a program which should be used to interpret the contents of the file. For instance, if the first line contains "#! /bin/sh", then the contents of the file are executed as a shell script.

You can get away without this, but you shouldn't. All good scripts state the interpretor explicitly. The '!' is also known as intepreter for the script to recognise correct compiler to be used.
Google UNIX.COM
 



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 10:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
UNIX Forum Content Copyright ©1993-2008 SilkRoad Asia All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102