yvesf / isbnlookup.sh

shellscript to lookup isbn number and booktitle from a pdf via google-books
2 stars 0 forks source link

Error in isbnlookup.sh #1

Open iDoka opened 4 years ago

iDoka commented 4 years ago

testcase:

$ ./isbnlookup.sh  High-Performance-Computing-Using-FPGAs.pdf 
search ISBN in file: High-Performance-Computing-Using-FPGAs.pdf ... isbn13 978-1-4614-1790-3
./isbnlookup.sh: line 113: [: -eq: unary operator expected
1 : Cannot open file '-q' at /usr/share/perl5/vendor_perl/XML/XPath.pm line 53.
 - Cannot open file '-q' at /usr/share/perl5/vendor_perl/XML/XPath.pm line 53.
 #isbn_Cannot open file '-q' at /usr/share/perl5/vendor_perl/XML/XPath.pm line 53.
.pdf
Pick Number ('o' for open file, or nothing to skip): 
Skip this file

CentOS 7 64bit

iDoka commented 4 years ago

string 113:

if [ `google_books_count_results "$infofile"` -eq 0 ]; then

it seems something going wrong

yvesf commented 4 years ago

@iDoka there is a quoting mistake in that if, try if [ "$(google_books_count_results "$infofile")" -eq 0 ]; then

but the reason for the error is probably that some sub-command is missing (wget, xpath from perl's libxml or pdftotext from poppler-utils).

iDoka commented 4 years ago

I tried. New error:

./isbnlookup.sh  High-Performance-Computing-Using-FPGAs.pdf 
search ISBN in file: High-Performance-Computing-Using-FPGAs.pdf ... isbn13 978-1-4614-1790-3
./isbnlookup.sh: line 113: [: : integer expression expected

It seem ISBN="978-1-4614-1790-3" but script expect number (compare to zero).

PS: fix issues with wget, xpath from perl's libxml or pdftotext dependency it was my previous excersice :)