Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Creating a shell/terminal script with multiple tasks

Creating a shell/terminal script with multiple tasks
Thread Tools
carterx
Mac Enthusiast
Join Date: Jan 2007
Location: Canada
Status: Offline
Reply With Quote
Mar 9, 2011, 11:50 AM
 
I've googled and looked around and can't seem to find the method to do this.

Right now I have an Automator flow setup to run 8 different commands using the "run shell script" option and it works beautifully but I would like to have one script. Right now I run it under the root user as I'm the only one that uses the script but as I will be creating this script to be used but multiple college sites I want this to run under any user but to just request an admin user password and run rather than having everyone use the root user which I don't hand out.

Thanks!!

     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Mar 10, 2011, 02:20 AM
 
You said what you want to do, but you forgot to ask a question.

Are you asking how to create a shell script to invoke 8 different tasks? In BASH, you might want to use a case statement.

However it may be easier to do what you want from AppleScript (which you can easily call from within Automator). You call shell scripts using the DO SHELL SCRIPT command. To request admin functions, you use the "with administrator privileges" clause:

Code:
do shell script "some shell command" with administrator privileges
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Mar 10, 2011, 03:45 AM
 
Why do you need Automator or Applescript for this?
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:54 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,