Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
In Linux extensions generally have no purpose like they do in DOS/Windows so aren't required. If someone puts an extension on a file they're just trying to let people know what it is without having to open it or run the "file <file>" command on it.
Many folks put .sh on ALL shell scripts (Bourne, BASH, Korn, Posix sh) and .pl on all Perl scripts. It is not required and neither helps nor hurts the way the script runs. It is more of a convention than anything else. If the contents/ownership/permissions of the following are all the same they would do the same thing:
Notice in above that I say even if it has a .pl it will run even if the interpreter inside it bash. Since the .pl is just part of the name it doesn't really mean "this is perl". Even naming it "this_aint_a_script" won't keep it from running if in fact it IS a script.
One caveat: They'll all do the same thing so long as there is nothing inside the script that is dependent on the name it was run as. It is actually possible to make one script (or binary) and put code inside it that looks at the name it was called as to determine how to run. That is more commonly seen in binaries than scripts though but I mention it just to avoid the inevitable pedantic response by someone else.
even with the file .sh, within the file, they still start out with
By the way - !#ksh assumes it can find ksh in your $PATH. It is more usual to put the full path to the shell on the interpreter line. (e.g. !#/bin/ksh).
Also the interpreter line itself is not even required. If you run a script in your current shell and it is designed to work in your current shell it will run just fine. However, it is always best to put the interpreter just to insure it runs in the shell you intended it for. Not having the interpreter could be a problem if you were say running in csh then tried to run either a perl or a bash script - csh wouldn't understand the commands it was seeing. The interpreter line tells it to invoke the appropriate shell as to run the commands.