NetBSD-Help archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: MakeI(1): what means {} ?
a) behaviour of {}.
{}, in contrast to the other shell wildcards "need not necessarily
be used to describe existing files.". I.e. the expansion need not
be generated by generating the (string) expansion by only expanding
into existing files. See below what this means.
b) {} doesn't just work :p (old basher, eh?)
/bin/csh: echo a{b,c} -> ab ac
/bin/sh: echo a{b,c} -> a{b,c}
/bin/ksh: set +o braceexpand (default I think); echo a{b,c} -> a{b,c}
/bin/ksh: set -o braceexpand; echo a{b,c} -> ab ac
c) putting things together
mkdir banzai
cd banzai
touch a* ;# creates a file named 'a*'
touch a? ;# touches 'a*'
touch a{1,2} ;# doesn't care about existing files
# but creates two files: a1, a2.
echo a* -> a* a1 a2
echo a? -> a* a1 a2
echo b* b? -> b* b?
touch b{1,2}{a,b}
echo b* b? -> b1a b1b b2a b2b b?
I think the last lines will explain what is meant by "need not necessarily
be used to describe existing files." In contrast to the other shell patterns
you can construct *STRINGS* following a certain rule, and not *MATCH EXISTING
FILES*.
Hope that helps with (the underlying, not your actual) problem.
The {} pattern expansion is documented in ksh(1) and csh(1) btw, both the
shells that support it (in contrast to sh(1)).
Regards,
-Martin
Home |
Main Index |
Thread Index |
Old Index