[Gllug] Finding filenames with special characters (was Mass renaming of files)

Tethys tet at accucard.com
Sun May 11 11:10:56 UTC 2003


Richard Jones writes:

>> * " | ?
>
>Essentially the problem here is with quoting. I think you'll find
>it's hard to write a simple script which copes with these cases.

#ifdef FLAMEBAT

Perhaps you're just using the wrong language! See my one line script
that handles it just fine :-)

#endif /* FLAMEBAIT */

The problem is that you're using perl to populate the arguments to mv,
which you then pass to the shell and hence they're subject to further
expansion before mv is called.

If you did it all natively in shell, then the quoting is handled
automagically for you (as a consequence of the order the shell performs
variable expansion and quote removal). You could probably achieve the
same by calling mv directly from within perl (I'm assuming perl has a
"system" or similar means of executing native programs) rather than
piping it to the shell.

Tet


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list