script run via keyboard binding does not write to file
1
vote
0
answers
51
views
Following bash script interprets text in an image file and writes to a .txt file.
#!/usr/bin/env bash
LD_LIBRARY_PATH="/usr/local/lib"
export LD_LIBRARY_PATH
/usr/local/bin/tesseract /home/martin/work/textpic.png /home/martin/work/tesseract-out
When I run it from the terminal the tesseract-out.txt is created, but when I run it via custom keyboard shortcut nothing is written. I have ensured that the correct script is run by putting
EDIT:
I verified that all needed libs are in path by putting
echo "test" > /home/martin/work/test.txt
in it, which creates the file.
I have run sudo chmod 777
on tesseract in case it was some permission issue.
I have an inkling that tesseract needs some lib files which are not in paths when the script is run by shortcut, so I put these lines at the top of my script file (I know that some of the lib files it needs are in /usr/local/lib):
LD_LIBRARY_PATH="/usr/local/lib"
export LD_LIBRARY_PATH
But it did not do the the trick. How can I debug what is going wrong? If I could obtain some kind of error message somehow, that would go a long way.
My linux version:
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"
NAME="Linux Mint"
VERSION="18.3 (Sylvia)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.3"
VERSION_ID="18.3"
HOME_URL="http://www.linuxmint.com/ "
SUPPORT_URL="http://forums.linuxmint.com/ "
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/ "
VERSION_CODENAME=sylvia
UBUNTU_CODENAME=xenial
The keyboard-shortcuts manager I use is the standard GUI one in Mint 18. Might be I could use something else to get a better error message?

/sbin/ldconfig -N -v $(sed 's/:/ /g' /home/martin/work/libs-in-path.txt
at the bottom of my script and crosschecking the output against readelf -d /usr/local/bin/tesseract | grep NEEDED
.
Asked by MyrionSC2
(111 rep)
Dec 24, 2019, 09:41 AM
Last activity: Dec 26, 2019, 10:51 AM
Last activity: Dec 26, 2019, 10:51 AM