djc@kesa.UUCP (Don Christensen) (11/22/89)
First, I am running bash 1.04 on a 386 clone and Interactive
UNIX sysVr3.2.
While using a script which called "basename", I noticed the following
problem:
In ksh:
prompt> echo `/bin/basename /usr/local`
local
prompt>
In bash:
prompt> echo `/bin/basename /usr/local`
.
prompt>
No matter what the argument to basename is under bash, the response is
always '.', even when it is assigned to a variable. Has anyone else
noticed this problem? Some may suggest work-arounds, but I need basename
to work since it is in a bunch of installed shell scripts.
The sysV basename is a shell script. You will have to find it yourself
since it is proprietary to AT&T.
Any help will be greatly appreciated.
Thanks,
Don
--
Don Christensen | UUCP: ...{sun}!daver!kesa!djc
Kesa Corporation | Internet: djc@kesa.UUCP
Santa Clara, CA (209) 944-7068 | Home Phone: (415) 966-1842greg@kesa.UUCP (Greg Onufer) (11/23/89)
From article <179@kesa.UUCP>, by djc@kesa.UUCP (Don Christensen): > > First, I am running bash 1.04 on a 386 clone and Interactive > UNIX sysVr3.2. > Same problem, same machine, but simplified: Sample script: FOO=$1 echo ${1:-EMPTY} <=== Does not work echo ${FOO:-EMPTY} <=== Does work Pass the script one argument and notice the results... If the ${:-} construct is used with $1, it thinks $1 is empty. If the same construct uses $FOO (which is a copy of $1), it works as expected. This is what causes /bin/basename on 386ix to work incorrectly. Did I fix it? I looked in expand_word_internal and decided to leave it to someone who knows what they are doing! Sample Output: cheers% bugscript foo EMPTY foo cheers% Cheers!greg
chet@cwns1.CWRU.EDU (Chet Ramey) (11/28/89)
In article <180@kesa.UUCP> greg@kesa.UUCP (Greg Onufer) writes: > echo ${1:-EMPTY} <=== Does not work I have sent a fix for this to Brian. Chet Ramey -- Chet Ramey Network Services Group "Where's my froggie?" Case Western Reserve University chet@ins.CWRU.Edu