Script hates whitespace

Keith Wyse <[email protected]>
Newsgroups gmane.user-groups.linux.scottish,gmane.org.user-groups.linux.edlug
Message-ID <CAPu+Kpc5yOP7AE-GDkRq67aKBK+1uE0q7z1XX1yARnABQC_zyQ@mail.gmail.com>
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

_______________________________________________
Scottish mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/scottish
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.