Page 1 of 1

[solved] simple bash script not working: command not found

PostPosted: Tue Jan 31, 2012 8:16 am
by lawful
Hi,
I'm a new Hazel user from Italy.

I use my iPhone to write down some LaTeX *.tex files and I want to compile them (obtaining *.pdf) via hazel script watching a dropbox folder.

if I run
Code: Select all
pdflatex -interaction=nonstopmode NAMEFILE.tex

in terminal, it works fine producing the NAMEFILE.pdf

so I set up a Hazel rule on my dropbox folder to run this simple embedded script
Code: Select all
pdflatex -interaction=nonstopmode $1


but it returns a COMMAND NOT FOUND error in the console:
2012-01-31 12:14:53.614 (null)[0] [c]RoofCorr.tex: Rule compila .tex matched.
/var/folders/nq/rkl5334159q63d57tvxmw0nc0000gn/T/hazelfolderwatch-54231: line 1: pdflatex: command not found
2012-01-31 12:14:53.686 hazelfolderwatch[54231] [Error] Shell script failed: Error processing shell script on file /Users/arnaldo/Dropbox/ifttt/auto-LaTeX/[c]RoofCorr.tex.


I can't figure it out, is there something I am missing?

Thanks in advance for the support!

Re: simple bash script not working: command not found

PostPosted: Tue Jan 31, 2012 1:42 pm
by Mr_Noodle
You need to specify the full path of the pdflatex command. The script is being executed in a context where it doesn't have access to your .bashrc/.profile/.whatever. In general, it's always a good idea to use the full pathnames of any programs in your shell scripts.

Re: simple bash script not working: command not found

PostPosted: Tue Jan 31, 2012 2:29 pm
by lawful
Mr_Noodle wrote:You need to specify the full path of the pdflatex command. The script is being executed in a context where it doesn't have access to your .bashrc/.profile/.whatever. In general, it's always a good idea to use the full pathnames of any programs in your shell scripts.


Thanks, it worked! :D