Patch for problems with profile script in Win9x [Attn: base-files maintainer]
Mon Mar 8 13:17:00 GMT 2004
On Sun, 7 Mar 2004, Paul Galbraith wrote:
> It seems that the default profile script checks what shell the user is
> running and sets appropriate defaults based on the shell. Unfortunately, on
> all Win9x installs that I've done recently, I've noticed that the profile
> isn't correctly identifying that bash is my shell (which it indeed is). The
> problem seems to be that $0 is set to 'BASH', whereas the script is testing
> for 'bash'. The following changes to /etc/profile fix things up for me.
> I know that /etc/profile comes from the base-files package, but I don't know
> where the source is located for that package...perhaps someone more
> knowledgeable than I can submit this patch to the appropriate place?
base-files is a source-only package. Also, this is the appropriate place
for patches. I'm sure the base-files maintainer reads this list.
> --- /etc/profile.orig 2004-03-07 10:03:26.000000000 -0500
> +++ /etc/profile 2004-03-07 10:24:12.000000000 -0500
> @@ -78,7 +78,11 @@
> # export CVSROOT
> # Shell dependent settings
> -case "$0" in
> +echo $0 > $SHELLNAME_TMP1
> +tr [:upper:] [:lower:] < $SHELLNAME_TMP1 > $SHELLNAME_TMP2
> +case `cat $SHELLNAME_TMP2` in
> bash | -bash | */bash | \
> bash.exe | -bash.exe | */bash.exe )
> # Set a HOSTNAME variable
> @@ -122,6 +126,8 @@
> PS1='$ '
> +rm $SHELLNAME_TMP1
> +rm $SHELLNAME_TMP2
> export PS1
FWIW, this problem has been reported before. One of the solutions
previously proposed for this problem was adding the various
capitalizations of "bash" to the case, i.e.,
case "$0" in
[Bb][Aa][Ss][Hh] | -[Bb][Aa][Ss][Hh] | */[Bb][Aa][Ss][Hh] | \
[Bb][Aa][Ss][Hh].[Ee][Xx][Ee] | -[Bb][Aa][Ss][Hh].[Ee][Xx][Ee] | */[Bb][Aa][Ss][Hh].[Ee][Xx][Ee] )
# Set a HOSTNAME variable
Your solution looks cleaner, although, as Karl pointed out, it can be
shortened to the following (also made space-in-filename friendly):
case "`echo "$0" | tr [:upper:] [:lower:]`" in
bash | -bash | */bash | \
bash.exe | -bash.exe | */bash.exe )
# Set a HOSTNAME variable
There is also a typo in the ksh section of the default profile (HOSTNAME
is not set), for which, IIRC, a patch has been submitted a while ago, and
the PRINTER setting for WinME is missing (also with a pending patch).
John, are you reading this?
|\ _,,,---,,_ firstname.lastname@example.org
ZZZzz /,`.-'`' -. ;-;;,_ email@example.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster." -- Patrick Naughton
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin