I have a shell script (which should open some program/file) which I want to invoke by clicking on a link in the generated .pdf
file (in my case a beamer presentation).
I tried including:
\href{run:./Demos/run_demo.sh}{DEMO}
in the source code. Then, when clicking on the link (when viewing with acrobat reader) it opens the script in a text editor rather then actually running it. I'm using MacTeX on a Mac OS X system.
What am I doing wrong?
Best Answer
On MacOS
run:...
hyperlinks are executed using theopen
command and, hence, processed by the default application configured for the specific file type. For.sh
files this usually is some text editor.You can change the default application from the finder (click on an
.sh
file and choose "Get Info"), however, MacOS accepts only "valid applications" (.app
compartments) as a target, so the Bash or Tcsh binaries cannot easily be defined as default application :-(Depending on your case a better solution might be to turn the shell script itself into an app and specify this in your
run:
link. This is easily possible using a tool like Appify.