Eric Blake wrote: ... >> Here's another way to do it: >> >> mktemp --suffix=X foo-XXXXXX > > Nice idea. Putting it all together, how about the following semantics: > > mktemp a => error, no run of X > mktemp aXX => error, run of X is too short > mktemp XXX => generates 3-character name (if possible) > mktemp aXXX.b => generates 6-character name (if possible) > mktemp --suffix=.b aXXX => longer spelling of the above line > mktemp aXXX --suffix=.b => likewise, if not POSIXLY_CORRECT > mktemp aXXXbXXX => generates aXXXb123 (only the last run changed) > mktemp --suffix=X aXXX => only way to generate a123X instead of a1234 > mktemp --suffix=.txt file => error, no run of X > mktemp --suffix=.txt aXXXb => error, explicit --suffix requires trailing X
Nice, comprehensive set of examples. > The changes from the existing behavior: > > Addition of a --suffix option (does it warrant a short option? Probably not > until it has had more field testing). Explicit use of this argument requires > trailing X in the template. I agree. > Addition of DWIM magic if --suffix is not present. Currently, mktemp aXXX.b > errors out, stating that there are too few X's in the template. The new > behavior recognizes any run of X, not just at the tail, and this goes a long > way to meet user expectations: > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548316 All sounds good. Thanks!
