mac terminal run a file of commands

Joined
Sep 30, 2012
Messages
2
Reaction score
0
Points
1
I am coming from Linux and trying to get a Mac to do what I want it to do. The question is what is the best tool to use. I want to mount (unmount) several remote disks. If I go into a terminal I can do the trick by

mount -t smbfs //username:pass@addr /Users/me/RemoteDisks/mnt1

Since I want to mount several disks I would like to put all of the information into a file, store it in Documents/subfolder and make a link to it on the desktop (or somewhere better, if there is a better place). At the moment I have manually run the appropriate command in the terminal and the remote disk is mounted and I see its contents. What I need is a one click method to run a file to mount all the disks.

I tried Apple script but that didn't like my commands. I don't know exactly what it is expecting to see and perhaps Apple script is the wrong tool. I have no problems in Linux, but the Mac is new to me and I don't know what I should be using.

Thanks, Ilan
 
Joined
Oct 22, 2007
Messages
8,967
Reaction score
287
Points
83
Location
London
Your Mac's Specs
Mac Mini Core i7 2012 | White 2009 MacBook 2 Ghz | 733 Mhz G4 Quicksilver

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
The "do shell script" command in Applescript should do the trick here. Take a look here. Put a few of those in a file for each mount and save it as an application.

A simple example:
Code:
do shell script "mount -t smbfs //username:pass@addr /Users/me/RemoteDisks/mnt1"
 
OP
I
Joined
Sep 30, 2012
Messages
2
Reaction score
0
Points
1
Thanks. do shell script looks like it will do the trick. I had tried it with just the part inside the quotes and that doesn't work.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top