Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 11-18-2011, 01:15 PM   #1
nimblebooks
Enthusiast
nimblebooks began at the beginning.
 
Posts: 28
Karma: 10
Join Date: May 2010
Device: Kindle
escaping spaces in command line --title

Hi,

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

Adam
'Adam
"Adam

in other words, it is dropping off everything after the space. What am I doing wrong?
nimblebooks is offline   Reply With Quote
Old 11-22-2011, 03:26 PM   #2
nimblebooks
Enthusiast
nimblebooks began at the beginning.
 
Posts: 28
Karma: 10
Join Date: May 2010
Device: Kindle
bump! still need help on this
nimblebooks is offline   Reply With Quote
Advert
Old 11-22-2011, 03:41 PM   #3
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Haven't tried it with Calibre, but this is generally a good technique:
http://www.cyberciti.biz/tips/handli...s-in-bash.html

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.
ldolse is offline   Reply With Quote
Old 11-23-2011, 11:00 AM   #4
nimblebooks
Enthusiast
nimblebooks began at the beginning.
 
Posts: 28
Karma: 10
Join Date: May 2010
Device: Kindle
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).
nimblebooks is offline   Reply With Quote
Old 11-23-2011, 01:31 PM   #5
teasonc
Member
teasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it isteasonc knows what time it is
 
teasonc's Avatar
 
Posts: 24
Karma: 2082
Join Date: Feb 2011
Device: Kindle DXG, Kindle Keyboard 3G
Quote:
Originally Posted by nimblebooks View Post
Hi,

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

Adam
'Adam
"Adam

in other words, it is dropping off everything after the space. What am I doing wrong?
This is from a recent working script (but for
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.

PYTHONBIN=/usr/bin/python
KMDR=$HOME/lib/kmdr.py
OUTDIR="/home/festus/Out"

for index in \
"For Whom The Bell Tolls.azw" \
"Saved By The Bell.azw" \
"The Ball of the Bell.azw"
do

INFILE="/home/festus/Download/$index"
echo $INFILE

## uncomment the following line when the echo (above) looks good.
## $PYTHONBIN $KMDR "$INFILE" $OUTDIR

sleep 3
done
exit 0

-=-=-=

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.

OLD:
...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).

Good luck.

--teasonc

Last edited by teasonc; 11-23-2011 at 01:46 PM. Reason: Clarification / some testing done.
teasonc is offline   Reply With Quote
Advert
Reply

Tags
epub, escape, title


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line - HOW? bookfanmd Calibre 19 01-12-2013 09:17 AM
Need help using command line tsger Recipes 2 07-16-2011 03:23 AM
Text file formatting - line feeds and spaces Fallingwater Workshop 6 07-04-2011 02:42 PM
Line spaces please get rid of them!!!!!!! JSWolf Calibre 2 12-13-2010 04:04 PM
Why use the command line? slantybard Calibre 6 07-22-2009 12:17 PM


All times are GMT -4. The time now is 07:13 PM.


MobileRead.com is a privately owned, operated and funded community.