|11-18-2011, 02:15 PM||#1|
Join Date: May 2010
escaping spaces in command line --title
I am having some trouble escaping the spaces in command line title when using a bash variable.
where I have
ebook-convert ... foo.epub ... --title$seed
or ebook-convert ...--title'$seed'
or ebook-convert ...--title"$seed"
where $seed="Adam Hall"
I am getting, respectively, title as
in other words, it is dropping off everything after the space. What am I doing wrong?
|11-22-2011, 04:41 PM||#3|
Join Date: Apr 2009
Device: PRS-650, iPhone
Haven't tried it with Calibre, but this is generally a good technique:
You could also try echoing the variables to sed and substitut the spaces with '\ ', or whichever slash is needed to escape it on the cli.
|11-23-2011, 12:00 PM||#4|
Join Date: May 2010
I never did solve the escaping problem, despite numerous painful experiments with sed and bash, but ultimately I realized I was making things way too hard on myself. I got rid of the --title flag and simply let Calibre determine the title automatically based on interior metadata (which I had tweaked).
|11-23-2011, 02:31 PM||#5|
Join Date: Feb 2011
Device: Kindle DXG, Kindle Keyboard 3G
a different operation). It needed to work with
my ebooks, so there's some crossover to it.
# CLOSE ! CLOSE / ---bin--/---sh---
Standard shell above, I mangled it in case the
forum doesn't approve.
for index in \
"For Whom The Bell Tolls.azw" \
"Saved By The Bell.azw" \
"The Ball of the Bell.azw"
## uncomment the following line when the echo (above) looks good.
## $PYTHONBIN $KMDR "$INFILE" $OUTDIR
I don't have my Calibre system at-hand so I cannot run additional tests.
EDIT: I tested the essentials. I didn't find any problem,
or other reason to edit this post to correct it further.
The mechanism is valid, but remember the shell and
a shell script are two different (but similar) environments.
...I'm pretty sure the above was from a working script. I know a script worked last month, and I think the above script is the one that worked (before I simplified it for use in this post).
Last edited by teasonc; 11-23-2011 at 02:46 PM. Reason: Clarification / some testing done.
|epub, escape, title|
|Thread Tools||Search this Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Command line - HOW?||bookfanmd||Calibre||19||01-12-2013 10:17 AM|
|Need help using command line||tsger||Recipes||2||07-16-2011 04:23 AM|
|Text file formatting - line feeds and spaces||Fallingwater||Workshop||6||07-04-2011 03:42 PM|
|Line spaces please get rid of them!!!!!!!||JSWolf||Calibre||2||12-13-2010 05:04 PM|
|Why use the command line?||slantybard||Calibre||6||07-22-2009 01:17 PM|