bash as default shell

der.hans PLUGd at LuftHans.com
Thu Oct 7 14:04:39 MST 2010


Am 06. Oct, 2010 schwätzte Dazed_75 so:

moin moin,

> Oh, BTW I read last week that ubuntu still uses bash for user shells, but
> uses dash as a lighter, faster shell for "system stuff".  I am not sure what
> that means other than /bin/sh links to /bin/dash because if I open a
> terminal and look at my env, it shows SHELL=/bin/bash.

Yes, system scripts such as those in /etc/init.d/ should use a true POSIX
shell. Bash emulates POSIX, but imperfectly and apparently it's large
compared to a POSIX shell.

As I understand it, dash is intended to be a leaner, meaner, more POSIX
compliant shell. For that reason, /bin/sh should now point at /bin/dash.

Poining /bin/sh to /bin/bash led to scripts that relied upon bashisms that
aren't in POSIX. That bit debian, a group that knows better :).

User shells should still generally be bash or zsh as they provide extra
capabilities useful to humans. I also use bash for my internal
programming, but would strongly consider POSIX compliant for system
scripts being released to others.

> The only other aspect I am aware of is if you run a script that opens with
> #!/bin/sh, you will be running dash, not bash.

Yes, the shbang line tells the system which shell to run for the script.
Putting /bin/sh on it will open whatever shell /bin/sh points out,
/bin/bash will get you bash, /usr/bin/php will get you php, /usr/bin/perl
will get you perl, etc.

Whatever's called needs to be installed at that location.

ciao,

der.hans
-- 
#  http://www.LuftHans.com/        http://www.LuftHans.com/Classes/
#  Fairy Tale, n.: A horror story to prepare children for the newspapers.


More information about the PLUG-discuss mailing list