www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/03/11:59:43

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_PD,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4C811B56.3010401@redhat.com>
Date: Fri, 03 Sep 2010 09:59:18 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2
MIME-Version: 1.0
To: pmcferrin AT columbus DOT rr DOT com
CC: Cygwin <cygwin AT cygwin DOT com>
Subject: Re: How does one change the default shell?
References: <AANLkTimkOLm5Oo8uBUZTuVyvzWCwNquwC8aSGcWRpLip AT mail DOT gmail DOT com> <OF5981DAE8 DOT C47B1D51-ON85257792 DOT 007A77BD-85257792 DOT 007B8620 AT lnotes-gw DOT ent DOT nwie DOT net> <4C802658 DOT 9090105 AT redhat DOT com> <OF880B7999 DOT 5BEFBE62-ON85257792 DOT 007C8E54-85257792 DOT 007D6191 AT lnotes-gw DOT ent DOT nwie DOT net> <4C802BB4 DOT 4000907 AT redhat DOT com> <4C8119D5 DOT 9070201 AT columbus DOT rr DOT com>
In-Reply-To: <4C8119D5.9070201@columbus.rr.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT redhat DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019