View Single Post
Old 04-25-2014, 06:28 PM   #13
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
So I added in the second parameter. Thanks, I didn't realize it required two. According to this post

Quote:
Originally Posted by pdurrant View Post
Download and install 32-bit (x86) ActivePython from here.
Download the kindlestrip 1.2.zip file. Unzip to give kindlestrip.py
Copy the book you want stripped to the same directory as kindlestrip.
Open a command window
use the cd command to switch to the same directory as kindlestrip
type python kindlestrip.py [BOOKNAME]
where [BOOKNAME] is the name of the ebook to be stripped.
it isn't required. I had scrolled through the kindlestrip thread for the first cli example.

Shouldn't this work just as well?

Code:
rm conversion.log

#fix for() loop not handling witespace
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

for file in $@; do

	echo "*******************************" >> conversion.log

	if $(kindlestrip "$file" "$file">> conversion.log); then
		echo "$file was successfully stripped!" >> conversion.log
	else 
		echo "$file was NOT stripped!" >> conversion.log
	fi
done

#restore default IFS
IFS=$SAVEIFS
I am unsure why you need to backup to filename.new

EDIT: Just realized what you meant when you said whitespaced files won't work -- because of the for loop. Fixed.

Last edited by eschwartz; 04-25-2014 at 06:48 PM.
eschwartz is offline   Reply With Quote