SCO Unix ksh (file name expansion using {}) question
Wm E. Davidsen Jr
davidsen at sixhub.UUCP
Mon Dec 31 15:53:30 AEST 1990
In article <1477 at beaudin.UUCP> john at beaudin.UUCP (John Beaudin) writes:
| I think it should work simply because there might be a script with the line
| $ cp {$*} /tmp
| which would fail if only 1 arg was passed via the command line. Besides,
| it works ok in csh.
That doesn't seem to work in csh, either, at least not here. Since
$* uses a blank rather than comma delimiter, the list isn't replaced.
Also, it has nothing to do with wildcard or filenames. The function in
ksh is to replicate any argument which contains a comma delimited list
enclosed in braces, with any stuff outside the braces but still in the
same argumnt.
Ex:
$ echo a{b,c}
ab ac
$ echo {a,b{c,d}}
a bc bd
I see exactly the same output with csh.
| Also, I've got Korn's book on ksh but can't find any reference to {} in
| pathname expansion; nor in the ksh man page. Maybe it's undocumented
| because it's a little buggy and not officially supported yet.
Maybe it's because the comma delimited list you tried didn't have a
comma in it. csh does not require the comma, nor does it allow use of
braces without quoting. If you do "ls {foo}" you will miss the file
"{foo}" and get the file "foo."
I don't think you should say either is "wrong," They are slightly
difirent, but in the usual case, where you want expansion of the list,
they work the same.
Many vendors of V.4 didn't enable this feature, a large loss in my opinion.
--
bill davidsen - davidsen at sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
sysop *IX BBS and Public Access UNIX
moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me
More information about the Comp.unix.sysv386
mailing list