LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 04-16-2007, 01:55 PM   #16
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969

It means you have a file in /bin named "dash" which is some other kind of shell presumably. Doing a quick Google I see the following link that suggests it is a smaller posix shell:
http://packages.debian.org/unstable/shells/dash.html

Anyway do an ls -l /bin/dash to see what its permissions are.

You might want to try changing the first line to #!/bin/bash just so you know you are using bash.
 
Old 04-16-2007, 02:07 PM   #17
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
I think I figured part of it out, I changed the sh to bash, and it worked.
 
Old 04-16-2007, 02:14 PM   #18
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
I think I am getting the hang of this.
 
Old 04-16-2007, 02:30 PM   #19
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
If you don't like "dash" you could delete the link (/bin/sh) then recreate it to point to "bash":

rm /sh (removes only the link /bin/dash will still be there)
cd /bin
ln -s bash sh
ls -l sh
 
Old 04-17-2007, 05:19 AM   #20
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Try running the original (not one you have modified) script, as root, like this:

bash ./install

I do not understand why this sometimes works with scripts that do not run properly ( as /bin/sh is a link to /bin/bash on my PC), but it does.

Edit: Sorry, I missed the second page of this thread - you have already solved your problem!

Last edited by tredegar; 04-17-2007 at 05:26 AM.
 
Old 04-17-2007, 09:09 AM   #21
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
Also doing the "bash ./install" wouldn't have worked because the interpreter line in the script would have started a sub-shell. His issue was the "dash" shell to which /bin/sh was linked.
 
Old 04-17-2007, 09:30 AM   #22
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
interpreter line in the script would have started a sub-shell. His issue was the "dash" shell to which /bin/sh was linked.
Thanks, I think I've got it now, but what about this post (which is what prompted me to offer my non-solution) http://www.linuxquestions.org/questi...d.php?t=543547 (Post numbers 8,9,10). Why / how did bash install.sh work there?
 
Old 04-17-2007, 01:40 PM   #23
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
OK I stand (sit actually) corrected.

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:
./test1

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:
bash ./test1

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.)
 
Old 04-19-2007, 06:30 AM   #24
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
OK I stand (sit actually) corrected...
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!
 
Old 04-19-2007, 09:14 AM   #25
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
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...
 
Old 07-18-2007, 05:29 PM   #26
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Quote:
Originally Posted by thepierre
What does dash mean??

lrwxrwxrwx 1 root root 4 2007-04-02 18:24 /bin/sh -> dash
"/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'.
 
Old 07-19-2007, 11:59 AM   #27
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
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.
 
Old 07-20-2007, 02:10 PM   #28
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Quote:
Originally Posted by jlightner
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php files only being executed in my root directory and nowhere else :( AtomicBanana Slackware 3 03-17-2007 02:57 AM
getting gawk to operate on a string in a bash script Lordandmaker Linux - Newbie 3 02-26-2007 01:01 PM
hotplug script executed 3 times Borelian Linux - Software 1 06-29-2004 12:46 AM
No effect when 'export' command executed in a script? sylvain_gnu Linux - Software 6 04-20-2004 08:15 PM
Simple script to be executed on startup. Korff Linux - General 2 06-03-2003 10:25 PM


All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration