Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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"
share|improve this question
4  
Is the FS mounted noexec? Is it possible the file has Windows line endings (CR+LF instead of just LF)? unix.stackexchange.com/questions/6821/bash-wont-execute-files –  user55325 Mar 11 '12 at 4:46
    
I 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 Mar 11 '12 at 10:09
    
The strings command should help you fix the issue without having to manually type the whole file again. –  Reuben L. Jun 12 '12 at 5:52
    
Jonny, you should answer your own question. –  MrDaniel Jul 27 '12 at 15:22
add comment

1 Answer

up vote 0 down vote accepted

I 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.