Results 1 to 5 of 5
  1. #1
    mac terminal run a file of commands

    Member Since
    Sep 30, 2012
    Posts
    2
    mac terminal run a file of commands
    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

  2. #2
    mac terminal run a file of commands
    louishen's Avatar
    Member Since
    Oct 22, 2007
    Location
    London
    Posts
    8,968
    Specs:
    Mac Mini Core i7 2012 | White 2009 MacBook 2 Ghz | 733 Mhz G4 Quicksilver
    You need to write it up in a text editor and save it as a shell script

    You can then create an application from the script

    Platypus | Sveinbjorn Thordarson
    Member of the Month September 2008 & August 2012 | Found advice useful? use the rep system

  3. #3
    mac terminal run a file of commands
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,395
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    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"
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  4. #4
    mac terminal run a file of commands

    Member Since
    Sep 30, 2012
    Posts
    2
    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.

  5. #5
    mac terminal run a file of commands
    cradom's Avatar
    Member Since
    Feb 14, 2004
    Location
    Nederland, Texas
    Posts
    4,074
    Specs:
    13in macbook - 10.10.4
    Quote Originally Posted by louishen View Post
    Thanks for that, looks interesting.
    Craig Domingue
    (\__/)
    (='.'=) This is Bunny. Copy and paste Bunny into your
    (")_(") signature to help him gain world domination

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mac OS X Fun Terminal Commands
    By bgranttech in forum OS X - Operating System
    Replies: 0
    Last Post: 07-19-2012, 10:41 AM
  2. Making an interface to run a php file in Terminal
    By juniorj23 in forum iOS and Apps
    Replies: 2
    Last Post: 06-09-2012, 02:42 PM
  3. Run Terminal commands outside application?
    By Corbab in forum OS X - Operating System
    Replies: 1
    Last Post: 11-24-2009, 02:11 PM
  4. i need to run a couple of terminal commands at starup
    By tero2008 in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 03-19-2008, 07:31 AM
  5. Multiple partitions in Mac - Run these commands
    By missileh in forum OS X - Operating System
    Replies: 0
    Last Post: 02-20-2008, 01:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •