4
I put the below script in a file called "volume", and put that file in a folder within $PATH. I can execute it fine by "bash thatpath/volume 10" but when I try to execute it using just "volume 10" from anywhere I get "/bin/bash: bad interpreter: Operation not permitted". The file's permissions are 755.
#!/bin/sh
FIRST_ARGUMENT="$1"
echo "Set volume to $FIRST_ARGUMENT!"
osascript -e "set volume output volume $FIRST_ARGUMENT"
4
Is the FS mounted
– user55325 – 2012-03-11T04:46:38.670noexec
? Is it possible the file has Windows line endings (CR+LF instead of just LF)? http://unix.stackexchange.com/questions/6821/bash-wont-execute-files1I read some similar issue and they also noted that the line endings might be messed up. So I started a new file and typed that all once more and saved. +x:ed it and it started working. So I guess yes, the line endings were the culprit. I did edit the file first time with TextEdit, it shouldn't give Windows line endings but um anyway it's fixed now. – Jonny – 2012-03-11T10:09:35.057
The
strings
command should help you fix the issue without having to manually type the whole file again. – Reuben L. – 2012-06-12T05:52:45.170Jonny, you should answer your own question. – MrDaniel – 2012-07-27T15:22:27.707