Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2002 11:30:13 -0700 (PDT)
From:      Joe Kelsey <joek@mail.flyingcroc.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/39198: sh aborts on variables with periods
Message-ID:  <200206121830.g5CIUDY90904@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/39198; it has been noted by GNATS.

From: Joe Kelsey <joek@mail.flyingcroc.net>
To: Peter Pentchev <roam@ringlet.net>
Cc: Joe Kelsey <joek@mail.flyingcroc.net>, bug-followup@FreeBSD.org
Subject: Re: bin/39198: sh aborts on variables with periods
Date: Wed, 12 Jun 2002 11:24:01 -0700

 Peter Pentchev wrote:
 
 >On Wed, Jun 12, 2002 at 06:08:27PM -0000, Joe Kelsey wrote:
 >  
 >
 >>>Number:         39198
 >>>Category:       bin
 >>>Synopsis:       sh aborts on variables with periods
 >>>Originator:     Joe Kelsey
 >>>      
 >>>
 >>>Description:
 >>>      
 >>>
 >>	/bin/sh does not gracefully accept variables with periods.
 >>    
 >>
 >[snip]
 >  
 >
 >>	if [ -n "$KSH_VERSION"] || [ -n "${.sh.version}" ]
 >>	then
 >>	  # ksh-only stuff
 >>	fi
 >>
 >>	Either /bin/sh has to allow parameters to contain periods or it
 >>	has to provide a reliable method of detecting /bin/sh versus
 >>	ksh.
 >>    
 >>
 >
 >Does ksh93 set $SHELL to 'sh' and, for login shells, '-sh', or does it
 >(as it should, IMHO) set it to 'ksh' and '-ksh', respectively?
 >  
 >
 ksh sets it to /bin/ksh.  Here is an example of the problem:
 unx48.staff.flyingcroc.net$ su
 Password:
 unx48# ps
   PID  TT  STAT      TIME COMMAND
 82521  p0  S      0:00.03 _su (csh)
 82523  p0  R+     0:00.00 ps
   175  v0  Is     0:00.02 login -p root
   341  v0  I      0:00.03 -csh (csh)
   343  v0  S+     0:07.30 top
   176  v1  Is+    0:00.00 /usr/libexec/getty Pc ttyv1
   177  v2  Is+    0:00.00 /usr/libexec/getty Pc ttyv2
   178  v3  Is+    0:00.00 /usr/libexec/getty Pc ttyv3
   179  v4  Is+    0:00.00 /usr/libexec/getty Pc ttyv4
   180  v5  Is+    0:00.00 /usr/libexec/getty Pc ttyv5
   181  v6  Is+    0:00.00 /usr/libexec/getty Pc ttyv6
   182  v7  Is+    0:00.00 /usr/libexec/getty Pc ttyv7
   139 con- I+     0:00.01 /bin/sh /usr/local/bin/safe_mysqld --user=mysql
   148 con- I+     0:00.00 qmail-lspawn |dot-forward .forward\n|preline 
 -f /usr/
 unx48# echo $SHELL
 /bin/csh
 unx48# sh
 Syntax error: Bad substitution
 # echo $SHELL
 /bin/csh
 # exit
 unx48# exit
 exit
 /home/joek
 unx48.staff.flyingcroc.net$ echo $SHELL
 /bin/ksh
 
 If there was a reliable way to detect /bin/sh I could use that instead 
 of trying to detect ksh.  Alternatively, if /bin/sh accepted periods in 
 variable names, it would pass the
  [ -n "${.sh.version}" ]
 test simply because it would think the parameter .sh.version was null.
 
 not sure if this helps...
 /Joe
 
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206121830.g5CIUDY90904>