11-18-2011, 01:15 PM | #1 |
Enthusiast
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? |
11-22-2011, 03:26 PM | #2 |
Enthusiast
Posts: 28
Karma: 10
Join Date: May 2010
Device: Kindle
|
bump! still need help on this
|
Advert | |
|
11-22-2011, 03:41 PM | #3 |
Wizard
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. |
11-23-2011, 11:00 AM | #4 |
Enthusiast
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).
|
11-23-2011, 01:31 PM | #5 | |
Member
Posts: 24
Karma: 2082
Join Date: Feb 2011
Device: Kindle DXG, Kindle Keyboard 3G
|
Quote:
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. |
|
Advert | |
|
Tags |
epub, escape, title |
|
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 |