Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Wow! That's brings backs lots of memories!</p> <p>Back in the 1980s and early 1990s, there were two basic shells, Bourne shell (<code>/bin/sh</code>) and C shell (<code>/bin/csh</code>).</p> <p>Bourne shell had very few user friendly things. There were no aliases or command substitutions. Therefore, most people liked using C Shell as their default shell.</p> <p>However, Csh was a terrible scripting language. (See <a href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/">http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/</a>). Therefore, you used C shell as your shell, but wrote your scripts in Bourne shell which had a much better syntax.</p> <p>However, there was a tiny little problem: Since your default shell is C Shell, typing a shell script name at the command line, and the C Shell would pick it up and try to execute it.</p> <p>To get around this, you put <code>:</code> as the first line in your program. This was a Bourne shell comment, but was an invalid C Shell command. Thus the script would fail to run if you forgot to put <code>sh</code> in front of it.</p> <p>Later on, systems would know if the first line was <code>:</code>, it should be a Bourne shell script. And, even later, you could put <code>#:</code> so it would be a comment and not a command. Some people put the name of the shell, <code>/bin/sh</code> next to it to help remind people were suppose to run this as a Bourne shell script.</p> <p>C shell started dying out after Kornshell started becoming popular. It was about this time when the shebang (<code>#!</code>) came out, but that was only for AT&amp;T and not the Berkeley derived systems. BSD systems didn't get the shebang until the late 1980s. And, Sun people used C Shell as their default shell until Solaris came out.</p> <p>I hadn't seen a program begin with <code>#: /bin/sh</code> in ages.</p> <p>BTW, it is common to start your scripts this way:</p> <pre><code>#! /usr/bin/env perl </code></pre> <p>This way, you use the version of Perl that's in your path and don't have to worry what directory it is in. For example, if you begin your script with:</p> <pre><code>#! /usr/local/bin/perl </code></pre> <p>And, Perl is actually in <code>/usr/bin</code>, your script won't run. The <code>env</code> program is always in <code>/usr/bin</code> and is guaranteed to work. Of course, if you want to use a specific version of Perl and not the one that is in the path, you'd go with the first method.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload