|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Shell Script not Recognised
Hey Guys.
I'm trying to execute this very simple piece of code on login. I can run the script on login easily, though when I do, OS X gives me the following error - "The .command file '...filepath...' could not open. Most likely it is not executable." I read a tutorial which told me to name the file with the .command suffix to make it execute properly, as the .sh suffix simply opened it in the text editor. The command I'm trying to execute is Code:
source /etc/bpalogin.init The full code looks like Code:
#! /bin/sh source /etc/bpalogin.init echo "Loaded BPA Login" To run the actual command from the terminal i have to execute it from root, i.e. sudo su -> password -> source /etc/bpalogin.init. Would that have anything to do with it? Any Ideas? Pete. |
|
#2
|
|||
|
|||
|
did you check the ownership and the permissions on the file?
|
|
#3
|
|||
|
|||
|
yeah i just checked and no luck, even on full permissions for everyone, though having said that, i needed (apparently) to change permissions to access my web server because of 403 errors and even after 'chmod-ing' everyone to 777 (read/write) it still didn't work. is there something i have to do after editing permissions?
any other ideas? P. |
|
#4
|
|||
|
|||
|
I am not a Mac person but did you check the "ownership" as well as the permissions?
|
|
#5
|
|||
|
|||
|
yeah just did and it belongs to me. i changed the ownership to 'system' and it made no difference. have anything specific in mind?
P. |
|
#6
|
|||
|
|||
|
again, I am not an OSX user
I would try renaming it with a .exe extension or .sh and then start the command with sh ?? |
|
#7
|
|||
|
|||
|
No, it still tells me that the "command not found" with the .sh extension. .exe is not native to mac osx and won't be recognised.
Hmmm...maybe I'll just have to run it manually when i need it? Quick question anyway, what does the 'source' command do? As in 'source /etc/bpalogin.init'? P. |
|
#8
|
|||
|
|||
|
sorry my experience is with bash scripts...normally a shell script does not even require an extension.
|
|
#9
|
|||
|
|||
|
have you tried
ex /etc/bpalogin.init or sh /etc/bpalogin.init without "source" ? |
|
#10
|
||||
|
||||
|
sometimes the application that created the file will mark it as a document of itself, that way double clicking it will open it with that program, i've had problems with this and it does get annoying, so i suggest you just wrap the thing in an apple script, then you won't run into this problem as you can save it as an application, also is you need to run sudo, well applescript has that built in and can pop up the normal authentication box for the password, the other nice this is that apple script can run it without opening another application (like the terminal)
just look at this thread for the script, if thats not enough, well i just copied it from the apple docs, so look through them
__________________
Feed ME |
|
#11
|
|||
|
|||
|
hey. thanks for that. i have had a very brief look at applescript and came up with this:
Code:
do shell script "sudo su" do shell script "source > /etc/bpalogin.init" though i obviously need to specify a password...how can i do that? P. |
|
#12
|
|||||
|
|||||
|
per apple docs
applescript Code:
you can omit the user/pass from there (again, look at the apple docs for how if you don't understand), if you omit it you just get a popup that will ask, there is no need for sudo/su when using applescript |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Mac Help > Shell Script not Recognised |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|