On Monday 26 September 2011, Gary V wrote: > >> > > Maybe some code like this should be enough to catch most potential > > erroneous definitions? > > > > case $po_download_command_format in > > *[^%]%s*[^%]%s*) ;; > > *) fatal "invalid format in \$po_download_command_format";; > > esac > > That's better than nothing, but catches 2 or more %s specifiers and not > 'exactly two'. > Oops, sorry! *blush*
> This is far from perfect too, but a step closer perhaps? > > case `echo $po_download_command_format |sed 's,[^%]*\(%[^%]\),\1,g'` in > %s%s) ;; > *) fatal 'invalid format in $po_download_command_format' ;; > esac > > ?? > Or this, to avoid one fork and possible quotation problems: case $po_download_command_format in *[^%]%s*[^%]%s*[^%]%s*) false;; *[^%]%s*[^%]%s*) : ;; *) false;; esac || fatal "invalid format in \$po_download_command_format" Either way, fine with me. Thanks, Stefano