This script needs to be executed as root to operate properly
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.
My understanding was that the interpreter SHOULD override the calling shell. Apparently for bash (at least on the FC4 and Debian systems I tested) when you run "bash <scriptname>" as opposed to just running "<scriptname>" it ignores the interpreter line.
On my FC4 system I tested against /bin/ksh (Korn Shell) and on my Debian system I tested against /bin/dash (presumably the same one the OP was linked to). On both I saw as expected when I just ran the script (named test1) as:
Then did a ps for processes on that terminal from another one that it displayed the original bash shell from login and THEN the sub-shell (ksh or dash) that I'd specified as interpreter.
However, when I ran it as:
The ps displayed the original bash shell from login THEN a sub-shell bash rather than the shell I'd specified for interpreter.
So that explains why it worked in the one you linked. I thought however the OP here had tried doing "bash ./install" and still had the error. I can't imagine why it would but maybe the symbolic link confused things. (His interpreter was /bin/sh which was symbolic link to /bin/dash.)
I'm not correcting you! , I'm just puzzled. And I thank you for your informative and thoughtful post. I didn't mean for you to go off and spend time experimenting, but you did: LQ service beyond the call of duty!
I think bash must be testing for how it was called, and with what arguments, and choosing to ignore the #!/bin/sh at the beginning of the script if it is called by bash scriptname. To my mind, this is weird behaviour, but I expect the developers know what they are doing, and why.
I just wish the linux development community could decide which shell we are all supposed to be using. bash I thought, was "it". Maybe it's not.
This sort of fundamental and basic decision is perhaps why I cannot get things like MythTV to install properly - Maybe I need to change all instances of #!/bin/sh to #!/bin/bash. Linking #!/bin/sh to #!/bin/bash (as is already the case on my (k)ubuntu system) doesn't seem to solve the problems. Sigh.
I am still learning.
Thanks for your input!
No problem. You didn't "force" me. I was curious why it would have worked in the thread you linked so tested it. I've been doing UNIX/Linux full time since 1991 and love the fact that I still learn something new every day.
By the way there is no need to change all the scripts - Just verify that /bin/sh is a symbolic link to /bin/bash. The OP had it as a link to /bin/dash though only God knows why. While I found dash on my Debian Sarge system I also had /bin/bash and /bin/sh was linked to bash.
I believe for the most part "bash" is "it" in Linux. Being an old UNIX hand I prefer ksh and usually install it. However it and bash have a lot of the same functionality. /bin/sh on some older UNIX systems is the old Bourne (non-POSIX) shell and that had very limited capabilities. Most Bourne shell scripts will run quite happily in bash or ksh but the reverse is not true. Interestingly the /bin/sh on HP-UX is actually the "POSIX" shell so is very similar in functionality to ksh and bash as well.
For extra confusion is the concept of "sh" used for "shar" files but that's another subject...
"/bin/sh" is a symbolic link to "dash", implicitly in the same directory. So when you run "/bin/sh", e.g. through a interpreter specification, it's "/bin/dash" that actually gets executed (except if that's a symlink, too, in which case we follow that link.) Next try 'ls -l /bin/dash'.
Thread is 3 months old and the link was discussed above.
You might want to check out "zero reply threads" to help people with current questions.
My bad. The question is the last message on the first page. I didn't notice there was a second page, and mistakenly assumed the question was never answered. As it's an easy one, I thought I'd answer it.
I'm subscribed to "zero reply threads" and have them e-mailed to me daily.