On Thu, Apr 12, 2012 at 11:05:41AM +0800, Clark Wang wrote:
> On Thu, Apr 12, 2012 at 04:54, DJ Mills <address@hidden> wrote:
> > This is a TERRIBLE idea, as attempting to word-split a command
> > substitution will fail horribly on any filenames with spaces (which is
> > very common in Windows), and will attempt pathname expansion on the
> > output. A simple glob should be used, or -exec if find is used.
>
> A glob expansion may cause the command line to be too long since the OP has
> 2.5 million files?
A glob expansion being passed as an argument list to a command will
fail, yes. But a glob expansion being used internally as the list
in a bash "for" command will be OK.
for f in *; do
mv -- "$f" "$f.txt"
done