Results 1 to 4 of 4
  1. #1
    Help making shell script for basic command

    Member Since
    May 14, 2012
    Posts
    7
    Help making shell script for basic command
    I need to make a shell script for a command to create aliases for 500 folders in 500 parent directories. I've found one page that was useful (http://www.alvinpoh.com/how-to-make-...al-in-mac-osx/), however I need to put the aliases on several computers, and once the aliases made with that script are off my computer, the aliases are "dead," due to rights permissions, I assume.

    The command works when I copy and paste the commands one by one into Terminal, but I'd rather not do that.

    Example of folder structure
    server/
    .......people/
    .............person1/
    .............person2/ etc.

    Example of command being used
    ln -s "/Volumes/server/people/person1" /shortcuts/

    Thanks for any help.

  2. #2
    Help making shell script for basic command
    Raz0rEdge's Avatar
    Member Since
    Jul 17, 2009
    Location
    MA
    Posts
    8,187
    Specs:
    27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3
    On Linux (that's what I have access to right now) something like this would work
    Code:
    for dir in `find /Volumes -mindepth 3`; do
        ln -s "$dir " /shortcuts/
    done
    The mindepth here ensures that you get the "server/people/personX" level. Without that, you end up getting "server" and "server/people" as well which you probably don't want.

    If mindepth is supported by OS X's "find", then this script should work..
    --
    Regards
    ...Ashwin



    Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.

  3. #3
    Help making shell script for basic command

    Member Since
    May 14, 2012
    Posts
    7
    Thanks, I see what you're getting at there, but that line of code didn't work. Here's a site with how OS X uses mindepth. Any suggestions how to change it to work? Thanks.

  4. #4
    Help making shell script for basic command

    Member Since
    May 14, 2012
    Posts
    7

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FTP Shell Script Q.
    By edwardlscott in forum OS X - Operating System
    Replies: 8
    Last Post: 03-06-2013, 01:37 AM
  2. Shell script help
    By Hyper in forum OS X - Development and Darwin
    Replies: 12
    Last Post: 05-22-2011, 11:36 AM
  3. Terminal -- shell script -- script will only read two lines of a file
    By Straitsfan in forum OS X - Apps and Games
    Replies: 0
    Last Post: 01-30-2011, 09:04 PM
  4. Making a Shell Script Executable
    By surfwax95 in forum OS X - Development and Darwin
    Replies: 10
    Last Post: 08-25-2010, 04:15 PM
  5. help with basic shell scripting
    By jrcal in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 06-11-2007, 12:08 PM

Posting Permissions

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