I have a bash script that takes a file name as an arg. It works great from the command line. When I right-click a file in KDE and select "open with", then point it to my script, it doesn't run. What am I doing wrong?
+1
A:
It is possible that your script relies on environment variables that get set by the terminal log in session. I don't know about KDE, but in Gnome, you can check "Open with Terminal" to ensure that the program is launched from a new Terminal session (with the same environment you'd get from ~/.bashrc). My suggestion is to add the following to the start of your script to ensure that it is being invoked:
echo "I've been called: $@" > i_was_invoked.txt
And then, elsewhere in your script, you should put printf/echo statements to determine where it has gone awry. If you do that and post your script, it may be possible to assist you further.
Michael Aaron Safyan
2010-05-18 05:39:51
I'd recommend using an absolute path with that output filename to make it easier to find.
Dennis Williamson
2010-05-18 09:32:18