Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8564111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:07:21+00:00 2026-06-11T17:07:21+00:00

I’ve inherited the following script to create accounts in OSX. I’d like to include

  • 0

I’ve inherited the following script to create accounts in OSX.

I’d like to include a check into it that first checks to see if an account already exists on the destination with that name, and if so, echoes a message “Account Exists”, then takes no other action and then moves on.

A typical /tmp/list.txt consists of just shortnames, I.e.:

jdoe
brianx
peterm
smithd

Your help is much appreciated!

#! /bin/sh

if [ $# -ne 1 ]
then
        echo mkhdir: Did not find required argument: group name
        echo Usage: mkhdir \[group\]
        exit 1
fi

for i in  `cat /tmp/list.txt` ; do
if [ ! -r /Volumes/UserStorage/Users/$i ]
   then
      mkdir /Volumes/UserStorage/Users/$i
      mkdir /Volumes/UserStorage/Users/$i/Backups
fi
chown -R $i:$1 /Volumes/UserStorage/Users/$i
chmod -R 700 /Volumes/UserStorage/Users/$i
find /Volumes/UserStorage/Users/$i -type d -exec chmod 701 {} \;
done
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:07:22+00:00Added an answer on June 11, 2026 at 5:07 pm

    The test for [ ! -r ... ] won’t tell if you /Volumes/UserStorage/Users/$i is a directory or not. Use

    for i in  `cat /tmp/list.txt` ; do
        if [ ! -d /Volumes/UserStorage/Users/$i ] ; then
             mkdir /Volumes/UserStorage/Users/$i
        else 
           echo "/Volumes/UserStorage/Users/$i already exists" >&2
        fi
        if [ ! -d /Volumes/UserStorage/Users/$i/Backups ] ; then
            mkdir /Volumes/UserStorage/Users/$i/Backups
        else
            echo "/Volumes/UserStorage/Users/$i/Backups already exists" >&2
        fi
        chown -R $i:$1 /Volumes/UserStorage/Users/$i
        chmod -R 700 /Volumes/UserStorage/Users/$i
        find /Volumes/UserStorage/Users/$i -type d -exec chmod 701 {} \;
    done
    

    701 Anyone know what the purpose is for 701 in the final find ... chmod?

    IHTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.