[Scottish] Script hates whitespace

Keith Wyse kwyse3436 at gmail.com
Fri Jul 19 10:17:06 UTC 2013


Hi all;
I'm having some trouble with a little script I'm writing - it hates
whitespace.
I have a bunch of books in .pdf format, but I can read them better in .epub
because of page resizing and font resizing. I wanted to use Calibre's
command line ebook-convert to modify them.
So the main line of the script is;

find . -name "*.pdf" -execdir sh -c 'ebook-convert {} "`basename {}
.pdf`.epub"' \;

This works on a file and path which doesn't have whitespace, but won't if
there are any whitespaces.
I've tried putting different types of quotes around the {} parts and using
the -print0 option to find, but these didn't do the trick. I'm no expert so
at a loss.

Can someone suggest a way to alter the script to accept whitespace?
I have other similar scripts to convert from .lit .txt. and .mobi to .epub
and .mobi by changing the options above.
Interestingly tho, ebook-convert works fine if I give it the .pdf with
whitespace in escaped format on the command line.

Many thanks
Keith
Scottish Borders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/scottish/attachments/20130719/aba27737/attachment.html>


More information about the Scottish mailing list