How does one change the default shell?

Eric Blake eblake@redhat.com
Fri Sep 3 15:59:00 GMT 2010


On 09/03/2010 09:52 AM, Paul McFerrin wrote:
>
> How about the obvious....Change the shell listed in the /etc/passwd file
> for the affected user. I for years had pdksh as my default shell. Yes, I
> was a long time AT&Ter, where the ksh was invented.

Quit top-posting, and http://cygwin.com/acronyms/#YSHFRTT

The OP already made it clear that changing /etc/password was not what he 
meant (that only changes your interactive shell), rather he was asking 
how to make /bin/sh be pdksh instead of bash (for all scripts, so that 
an arbitrary script ./foo can use pdksh features).

If a shell script starts with a #! line, then that's the shell that will 
be used, regardless of the user's /etc/passwd shell or the current 
setting of $SHELL.  And if a shell script does not start with a #! line, 
then it will be executed with /bin/sh, again regardless of /etc/passwd 
or $SHELL.  So the only way to change the equation is to change /bin/sh, 
or to use an appropriate #! line in all affected scripts.  Personally, I 
find #! the more robust option (just like I recommend that you should 
use #!/bin/bash if you intend on using a bash feature, rather than 
blindly relying on the fact that /bin/sh defaults to bash in cygwin).

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list