Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
07-31-2012, 02:19 PM
|
#16
|
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,577
|
Direct execution is when you use the script name itself as the command name, including the relative and absolute path versions in the above discussion.
source and launching a specific shell name as the main command mean that the script becomes an argument to that command, and the file is read, not executed.
|
|
|
|
07-31-2012, 05:01 PM
|
#17
|
|
LQ Newbie
Registered: Aug 2011
Posts: 17
Original Poster
Rep: 
|
Quote:
Originally Posted by David the H.
Direct execution is when you use the script name itself as the command name, including the relative and absolute path versions in the above discussion.
source and launching a specific shell name as the main command mean that the script becomes an argument to that command, and the file is read, not executed.
|
OK, so that would mean that the she-bang is respected when executing a script (using the script name as the command), but not when calling through 'source' or giving the script as an argument to 'sh', 'bash', etc.
|
|
|
|
07-31-2012, 05:54 PM
|
#18
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,259
|
The she-bang notation is used by the kernel when it launches an executable. If it sees the she-bang, it loads the specified interpreter (can be anything at all, not just a shell), and passes the name of the script as its first commandline argument. The interpeter then opens the file, and interprets the contents.
'Sourcing' is done by an already-running shell itself, and is a behavior of those shells (possibly all major shells).
[EDIT] #! - the Unix truth as far as I know it. explains this in some detail.
Last edited by theNbomr; 08-01-2012 at 10:45 AM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:22 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|