SunQuest
           Mac Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsMac Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old January 13th, 2007, 08:41 AM
petehayes petehayes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Australia
Posts: 121 petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 7 m 56 sec
Reputation Power: 6
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.

Reply With Quote
  #2  
Old January 13th, 2007, 09:07 AM
tj_nt tj_nt is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Posts: 1,592 tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 10 m 25 sec
Reputation Power: 616
did you check the ownership and the permissions on the file?

Reply With Quote
  #3  
Old January 13th, 2007, 06:20 PM
petehayes petehayes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Australia
Posts: 121 petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 7 m 56 sec
Reputation Power: 6
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.

Reply With Quote
  #4  
Old January 13th, 2007, 06:22 PM
tj_nt tj_nt is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Posts: 1,592 tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 10 m 25 sec
Reputation Power: 616
I am not a Mac person but did you check the "ownership" as well as the permissions?

Reply With Quote
  #5  
Old January 13th, 2007, 06:26 PM
petehayes petehayes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Australia
Posts: 121 petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 7 m 56 sec
Reputation Power: 6
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.

Reply With Quote
  #6  
Old January 13th, 2007, 06:47 PM
tj_nt tj_nt is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Posts: 1,592 tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 10 m 25 sec
Reputation Power: 616
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 ??

Reply With Quote
  #7  
Old January 13th, 2007, 06:58 PM
petehayes petehayes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Australia
Posts: 121 petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 7 m 56 sec
Reputation Power: 6
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.

Reply With Quote
  #8  
Old January 13th, 2007, 07:07 PM
tj_nt tj_nt is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Posts: 1,592 tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 10 m 25 sec
Reputation Power: 616
sorry my experience is with bash scripts...normally a shell script does not even require an extension.

Reply With Quote
  #9  
Old January 13th, 2007, 07:09 PM
tj_nt tj_nt is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Posts: 1,592 tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 8 h 10 m 25 sec
Reputation Power: 616
have you tried

ex /etc/bpalogin.init

or sh /etc/bpalogin.init


without "source" ?

Reply With Quote
  #10  
Old January 13th, 2007, 07:18 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 4 h 34 m 24 sec
Reputation Power: 787
Send a message via AIM to edman007
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

Reply With Quote
  #11  
Old January 13th, 2007, 07:57 PM
petehayes petehayes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Australia
Posts: 121 petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level)petehayes User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 7 m 56 sec
Reputation Power: 6
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.

Reply With Quote
  #12  
Old January 13th, 2007, 08:10 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 4 h 34 m 24 sec
Reputation Power: 787
Send a message via AIM to edman007
per apple docs

applescript Code:
Original - applescript Code
    do shell script "/etc/bpalogin.init" user name "me" password "mypassword" with administrator privileges


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

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsMac Help > Shell Script not Recognised


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump