View Single Post
Old 11-23-2011, 02: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 02:46 PM. Reason: Clarification / some testing done.
teasonc is offline   Reply With Quote