LinuxQuestions.org
Register a domain and help support LQ
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 10-17-2009, 10:50 AM   #16
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 266

Original Poster
Rep: Reputation: 35

Can you guys post where your "sh" is pointing to please. Seems mine isn't correct if going by the posts on here.
 
Old 10-17-2009, 11:57 AM   #17
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,136

Rep: Reputation: 97
It depends on what Distribution you are using, most /bin/sh should refer to bash, however for debian based distributions it should be /bin/dash (A debian specific shell, I believe based on ash)
 
Old 10-17-2009, 01:35 PM   #18
fbsduser
Member
 
Registered: Oct 2009
Distribution: Hackintosh, SlackWare
Posts: 267

Rep: Reputation: 30
Quote:
Originally Posted by fusion1275 View Post
Can you guys post where your "sh" is pointing to please. Seems mine isn't correct if going by the posts on here.
Your "sh" symlink points to a shell called dash. You might want to remove that symlink and create a new one pointing to bash.
 
Old 10-19-2009, 08:11 AM   #19
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 266

Original Poster
Rep: Reputation: 35
So does that mean that Ubuntu is set up incorrectly?

Shouldn't it default to the bash shell?
 
Old 10-19-2009, 08:17 AM   #20
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by fbsduser View Post
Your "sh" symlink points to a shell called dash. You might want to remove that symlink and create a new one pointing to bash.
This is a bad idea. All sorts of things might break. Please don't do this.

@OP: The situation you have is "correct" for Debian based systems.
 
Old 10-19-2009, 08:22 AM   #21
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 266

Original Poster
Rep: Reputation: 35
Yeah thought changing it would be a bad idea!!

So any ideas why I get errors and some dont? Seems to depend on what distro they are using now doesnt it??
 
Old 10-19-2009, 08:31 AM   #22
Lordandmaker
Member
 
Registered: Sep 2005
Location: London, UK
Distribution: Debian
Posts: 258

Rep: Reputation: 38
Quote:
Originally Posted by fusion1275 View Post
So any ideas why I get errors and some dont? Seems to depend on what distro they are using now doesnt it??
For some people, sh is a link to /bin/bash and for the debianites its /bin/dash.

Dash is a debian-developed shell which is being used where the features of bash aren't needed, and speed and simplicity are. There's been warnings for a while that scripts with bashims need a /bin/bash shebang, not a /bin/sh.

So the difference is down to the fact that, even though they're invoking them the same way, some people are running
Code:
/bin/bash -x
, and others are running
Code:
/bin/dash -x
, and these are different shells.
 
Old 10-19-2009, 08:43 AM   #23
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
hmm... OP used #!/bin/bash. I wonder why that didn't take effect.
 
Old 10-19-2009, 10:27 AM   #24
GazL
Senior Member
 
Registered: May 2008
Posts: 4,177
Blog Entries: 5

Rep: Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618
Quote:
Originally Posted by rn_ View Post
hmm... OP used #!/bin/bash. I wonder why that didn't take effect.
because he was explicitly telling it to use 'sh' on the command line when he invoked it.
 
Old 10-19-2009, 11:22 AM   #25
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by GazL View Post
because he was explicitly telling it to use 'sh' on the command line when he invoked it.
hm... i guess my understanding of the 'shebang' was incorrect. I always thought it was used to override whatever the invoking shell may be.

hey, this is the second new thing i have learned today.

Thanks.
 
Old 10-19-2009, 11:26 AM   #26
fusion1275
Member
 
Registered: Jul 2007
Location: Portsmouth, Hants
Distribution: Linux Mint
Posts: 266

Original Poster
Rep: Reputation: 35
Well looks like my little issue has become into a lesson. I shall make a note of this.
 
  


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
Whats a good geotagging software/script? enine Linux - Software 3 08-24-2009 08:12 PM
Whats wrong with this script?? Reegz Linux - General 2 09-11-2006 03:24 AM
Whats wrong with my dialing script? pen^2 Linux - General 13 09-16-2004 03:34 AM
Whats wrong with this script??? Sammy2ooo Linux - Networking 2 08-24-2004 07:20 AM
Whats wrong with this PERL script? VisionZ Linux - Newbie 25 03-25-2004 09:58 AM


All times are GMT -5. The time now is 09:52 AM.

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