Hello!
I'm using marvellous program Freemind, see freemind.sourceforge.net/wiki/index.php/Main_Page, everyone should find this program useful for lots of daily tasks!
It's a Java program and it allows us to launch an external program where the first parameter is a path of a file. In Linux it defaults to konqueror which is not good to open files like OpenOffice.org documents or Adobe PDFs in a user-friendly way, since I'm using Gnome as default desktop.
So I thought on using a shell script to parse the file received, detect the file extension and then launch the corresponding program.
I have very little experience on shell scripting so I ask for help on how to do this.
The script receives a path with this format:
file:/home/myusername/path/to/file.that.can.have.dots.before.extension.pdf
So the script will have to extract what's on the right of : (this I already think it's working)
Then it will have some kind of WHILE command to go trough the string to find the extension, save it in some variable, then have something like a CASE that for predefined extension types will then launch the corresponding program.
Here's what I got until now:
Code:
#!/bin/bash
PDFPROG=/usr/bin/acroread
ODTPROG=/usr/bin/oowriter
PATH=`echo $1 | awk -F'file:' '{print $2;}'`
$PDFPROG $PATH
But it's not working
I try this
Code:
fmlaunch file:/home/david/actual/academico/Phd/bibliografia/function/bickhard/ErrorDynamics.pdf
and I get this:
Code:
/usr/bin/acroread: line 8: ls: command not found
/usr/bin/acroread: line 8: sed: command not found
/usr/bin/acroread: line 9: dirname: command not found
/usr/bin/acroread: line 17: dirname: command not found
/usr/bin/acroread: line 102: dirname: command not found
/usr/bin/acroread: line 109: dirname: command not found
/usr/bin/acroread: line 117: ls: command not found
/usr/bin/acroread: line 117: sed: command not found
/usr/bin/acroread: line 118: expr: command not found
ERROR: Cannot find installation directory.
I wonder if it's because acroread is also a script?