Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- Date: Wed, 5 Aug 2009 22:10:58 +0900
- From: Curt Sampson <cjs@example.com>
- Subject: Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- References: <4A7504C9.9070806@example.com> <20090802034303.GA70018@example.com> <87hbwqd481.fsf@example.com> <4A785E61.8080909@example.com> <874osmcul8.fsf@example.com>
- User-agent: Mutt/1.5.18 (2008-05-17)
On 2009-08-05 21:29 +0900 (Wed), Stephen J. Turnbull wrote: > > #!/bin/bash > > for i in `find -name '*.ai'`; do > > uniconverter input ${i} output ${i%.ai}.svg > > done > ... > jep points out the possibility of names with spaces (or even more evil > things) in them. I *think* that putting double (not single!) quotes > around the variable references will handle that case, eg, "${i}". Unfortunately for this case, no, it will not; the backquoted portion is replaced by the entire output of find, and only then is field splitting performed according to the contents of $IFS: $ touch _a "_b c" _d $ for i in $(find . -maxdepth 1 -name _\*); do echo $i; done ./_a ./_d ./_b c Note that this isn't a problem for shell globs: $ for i in _*; do echo $i; done _a _b c _d If you really want to deal with funny filenames, even those with newlines in them, I believe that your best bet is to use a script that takes the filename as a parameter, use -print0 with find, and use xargs to invoke the script: $ cat > doit <<__EOF__ uniconverter input "$1" output "${1%.ai}.svg" __EOF__ $ find . -maxdepth 1 -name _\* -print0 | xargs -0 doit > Shell quoting is very hard to get correct.... I would consider myself an rather experienced shell scripter, and even more me quoting stuff truly properly is very hard to get right. Generally, I no longer bother to try to get it right for all cases, as it also happens to reduce readability. If you don't know shell, I'd probably recommend just learning Ruby or Python or something like that instead, and using that for your scripting needs. cjs -- Curt Sampson <cjs@example.com> +81 90 7737 2974 Functional programming in all senses of the word: http://www.starling-software.com
- Follow-Ups:
- References:
- [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- From: Dave M G
- Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- From: Scott Robbins
- Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- From: Stephen J. Turnbull
- Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- From: Dave M G
- Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Zurus distributions experience
- Next by Date: Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- Previous by thread: Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- Next by thread: Re: [tlug] Batch conversion of a bunch of Illustrator files to SVG files
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links