The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-08-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
To answer the first question, this is to disable the option processing by sh. This means that if you pass any arguments to the script, sh will not try to interpret them itself, but will treat them as arguments.

To quote the BSD sh manual,
Quote:
Originally Posted by BSD sh manual
A ``--'' or plain ``-'' will stop option processing and will
force the remaining words on the command line to be treated as arguments.
In the case of your second question, the script does not run as './unix.run' because you are trying to 'execute' a file that is not executable (no x bits are set). With 'sh ./unix.run' the binary '/usr/bin/sh' is executed and the unix.run script is passed to it as arguments.

Cheers!

P.S. BTW, the magic number only comprises the first 2 or 3 (both are legal) bytes in the file. The rest of the line tells the kernel what is to be used to interpret the rest of the file.

Last edited by blowtorch; 07-08-2005 at 10:47 AM.. Reason: an aside about the magic number