Page 1 of 1

Bash Script Exits with code 127, zsh script doesn't

PostPosted: Sun Dec 02, 2012 2:51 am
by phae_girl
I was playing around with ffmpeg tonight, trying to have Hazel use it through a shell script to do some stuff, and I ran into a bit of weirdness. Whenever I would try to call ffmpeg using sh or bash, the script would fail with an exit code 127. This happened both with just ffmpeg and the full path specification. The even weirder part is that just for kicks I switched to zsh and everything worked just fine.

Has anyone observed similar behaviour? Any suggestions on which dark corners of bash I should start poking my nose into?

Thanks

Phae
Vegans With Typewriters

Re: Bash Script Exits with code 127, zsh script doesn't

PostPosted: Mon Dec 03, 2012 1:59 pm
by a_freyer
A quick search tells me that exit 127 means that ffmpeg is installed in the correct directory. I'd suggest updating ffpeg and installing in the suggested location.

Barring that, check the logs for Hazel to find additional error information. Post what you find.

Re: Bash Script Exits with code 127, zsh script doesn't

PostPosted: Wed Dec 05, 2012 4:59 pm
by phae_girl
Doing a whereis under bash for ffmpeg returns nothing. Trying with where under zsh returns /usr/local/bin/ffmpeg, which seemed reasonable. I did another install off ffmpeg using homebrew (brew install ffmpeg --use-clang) and everything installed fine. I checked again under bash with whereis ffmpeg and still nothing. where ffmpeg under zsh returned /usr/local/bin/ffmpeg again.

I suspect that something is awry in my my $PATH settings, but I can't for the life of me figure out why one shell sees it and the other one doesn't. I know that I can just use zsh and things will work, but I'm in it for the sport now.

- Phae

Re: Bash Script Exits with code 127, zsh script doesn't

PostPosted: Wed Dec 05, 2012 5:09 pm
by a_freyer
Well, whereis uses hardcoded paths (I'm pretty sure), so its less likely to find a binary installed by a third party. Have you been able to find out what exit code 127 is?

Re: Bash Script Exits with code 127, zsh script doesn't

PostPosted: Sat Dec 08, 2012 1:57 am
by phae_girl
According to The Linux Documentation Project, a script exit code of 127 is "Command Not Found". A little more poking around showed that the locate database didn't exist, so I created it and threw a symlink in /usr/bin/ for good measure. Hmm…I wonder if there is a permissions issue.

- Phae

Re: Bash Script Exits with code 127, zsh script doesn't

PostPosted: Mon Dec 10, 2012 3:31 pm
by Mr_Noodle
Except for shell built-ins, any commands you call should have a full path to the command instead of relying on any environment variables. There may be another command you are invoking that isn't fully specified or one of the commands is calling something, relying on environment variables.

Re: Bash Script Exits with code 127, zsh script doesn't

PostPosted: Sun Dec 30, 2012 12:42 am
by phae_girl
Eventually I did mess around with it again and made it work specifying the full path for ffmpeg. I put it off as just general bash flakiness. Oh, and the command that I was looking for to reveal the path to ffmpeg was which. I can't explain it, but I learned a whole bunch of stuff that will come in handy in the future.