How to place a comma in 'a{b,c,d}e' metanotation

Steve Clark clark at cme.nist.gov
Fri Jan 25 07:51:32 AEST 1991


>>>>> On 24 Jan 91 17:29:18 GMT, rouben at math9.math.umbc.edu said:

rouben> <Asks how to get commas into the expansion of a{b,c,d}e?>

The problem (apparently) is that the shell handles escapes (and
variable substitutions, unfortunately) before expanding these lists.
If any escapes or variables produce commas, they will be interpreted
as separators between the braces.  So you need to force the shell to
expand the braces before the commas show up.  I don't see a solution
with escapes: the comma would still have to be there right from the
start.  Instead, I'd use a variable (to hold the comma until the
appropriate time) with eval (to stick in the comma(s) after the braces
are expanded).

rouben> ... ideally I would have liked to say:
rouben> 	xset fp+ /path/{dir1\,,dir2\,,dir3}

		% set c=,
		% xset fp+ `eval echo /path/{dir1\$c,dir2\$c,dir3}`

Which is only slightly longer :-) than the resulting command:

rouben> 	xset fp+ /path/dir1, /path/dir2, /path/dir3
--
-steve
------------------------------------------------------------------
Steve Clark
National Institute for Standards and Technology (formerly NBS)
clark at cme.nist.gov		..uunet!cme-durer!clark
(301)975-3595 / 3544



More information about the Comp.unix.questions mailing list