also @ TechSpot: Engineers boost CPU/GPU speed 21%, could be a glimpse of AMD's future
Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Sign up or Login to participate.

Go Back   TechSpot OpenBoards > Software > Software Apps

Begin your free trial now Pay-as-you-go options starting at $10/user/month

What does the line: #!/usr/bin/sh do?

Thread Tools Search this Thread
  #1  
Old 05-16-2002
lokem's Avatar
TechSpot Addict
 
Location: Assembled In Malaysia
Member since: Mar 2002, 773 posts
What does the line: #!/usr/bin/sh do?

Hi all,

Hope someone here is familiar with shell scripts...

Anyway, at the top of a script, there'll almost always be a line like #!/usr/bin/sh

Anyone know what that line does exactly?

Does this mean that the script will be called using /usr/bin/sh <scriptname>?

TIA.
  #2  
Old 05-16-2002
Julio's Avatar
TechSpot Executive Editor
 
Location: Ecuador
Member since: Feb 2002, 5,351 posts
System specs
If I'm not wrong, the location of the language installation files on the server. (the wording might be wrong but you get the idea )
  #3  
Old 05-16-2002
lokem's Avatar
TechSpot Addict
 
Location: Assembled In Malaysia
Member since: Mar 2002, 773 posts
Quote:
If I'm not wrong, the location of the language installation files on the server. (the wording might be wrong but you get the idea )
Language installation file? Uhh... DO you mean the shell exec file?
  #4  
Old 05-17-2002
recoombe's Avatar
Newcomer, in training
 
Member since: May 2002, 14 posts
i'm no huge expert but usually that line means what shell you have to run the program in to get it to work. when i used to do korn shell programming in junior year of college we always had to put !/bin/sh (or wahtever the syntax is) so that the shell will run the script as korn instead of maybe a c shell script. same thing for perl, etc. if the shell you're trying to execute the program in matches that line then you're ok. its just to make sure that if the shell is different from the language of the program that it runs on the right compiler instead of for example a korn shell script trying to compile on gcc or something like that.
  #5  
Old 05-22-2002
Rick's Avatar
TechSpot Special Forces
 
Location: Los Angeles, CA
Member since: Feb 2002, 5,596 posts
Quote:
http://ibm1.cicrp.jussieu.fr/info/en...ixcmds5/sh.htm

sh Command

Purpose
Invokes the default shell.

Syntax
Refer to the syntax of the ksh command. The /usr/bin/sh file is linked to the Korn shell.

Description
The sh command invokes the default shell and uses its syntax and flags. The shell linked to the /usr/bin/sh path is the default shell. The standard configuration of the operating system links the /usr/bin/sh path to the Korn shell. See "Korn Shell" in AIX 5L Version 5.1 System User's Guide: Operating System and Devices for specific information about Korn shell features.


Flags
Refer to the flags for the Korn shell (ksh command).


Files

/usr/bin/sh Contains the sh command.

This is much like to run perl scripts, you have to type in something along the effect of #!/usr/bin/perl

This line is called a "shebang line".
Closed Thread

Similar Topics
Topic Replies Forum
Top of the line gaming rig 0 Hot Deals
My Dsl line 9 Storage and Networking
WMP line in 3 Software Apps
Command line Help 3 Windows OS
How do I create dash line and thick line in Direct 3D 0 Gaming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
All times are GMT -4. The time now is 01:15 AM.