Shellscript strange behaviour

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Shellscript strange behaviour Mon Aug 05, 2024 8:17 am • by Graf_Wetter
Hi,
I have a shellscript (/bin/bash), that has been run for years as an embedded script.
When I want to use it as an external script, it doesn´t work.
But ... when I turn Hazel´s debug mode on, it does work as an external script.
What could be the reason ?
I needed the debug mode to be turned off in everyday use.
Other scripts with similar structure work without any problems.
Thanks,
Jörg
Last edited by Graf_Wetter on Mon Aug 05, 2024 8:59 am, edited 1 time in total.
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Re: Shellscript strange behaviour Mon Aug 05, 2024 8:41 am • by Mr_Noodle
Can you post the script?
Mr_Noodle
Site Admin
 
Posts: 11577
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Shellscript strange behaviour Mon Aug 05, 2024 8:52 am • by Graf_Wetter
PM
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Re: Shellscript strange behaviour Tue Aug 06, 2024 3:05 pm • by Graf_Wetter
did you get my PM ?
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Re: Shellscript strange behaviour Wed Aug 07, 2024 8:31 am • by Mr_Noodle
Yes, but in the future, please use email. The PM system here is unreliable.

The script is a bit long and I don't see anything obvious. What kind of failure do you get? I suggest maybe writing out periodically to a file with diagnostics to narrow down where in the script the error is happening.
Mr_Noodle
Site Admin
 
Posts: 11577
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Shellscript strange behaviour Wed Aug 07, 2024 9:23 am • by Graf_Wetter
The script just stops and the triggered file disappears.
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Re: Shellscript strange behaviour Thu Aug 08, 2024 3:52 am • by Graf_Wetter
FYI
Very simple solution:
The full path to the tool cpdf had to added (2nd function on top of the script).
But: Why did it work in Debug Mode without the path ? Normal behaviour ?
Thanks.
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Re: Shellscript strange behaviour Thu Aug 08, 2024 8:46 am • by Mr_Noodle
Not sure why it worked in debug mode but you should always specify the full path as you cannot assume any environment variables will be set (like PATH). All debug mode does is connect to stdout/stderr and write that out to Hazel's logs.
Mr_Noodle
Site Admin
 
Posts: 11577
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Shellscript strange behaviour Thu Aug 08, 2024 9:17 am • by Graf_Wetter
Thanks !
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am


Return to Support