0

So I created my users.... Now for each of there dir's I have to create the following structure.

Users Home Directory / Staff / Info / Personal

Then create a file in each dir called file1.txt, file2.txt, file3.txt

I tried something like mkdir create "users home directory / staff / info / personal but had no success I also cant find any help from research online. Yes I am very new to Ubuntu!

1 Answers1

1

Here's a script. Modify USER_LIST to suit your needs and delete the echo keywords when you've verified the script does what you want.

#!/bin/bash

USER_LIST="user1 user2 user3 user4"

cd /home || exit 1;
for user in $USER_LIST; do
    echo mkdir -p "$user"/{Staff,Info,Personal};
    for dir in Staff Info Personal; do
        echo touch "$user"/$dir/file{1,2,3}.txt;
    done;
done;

On the other hand, you could have modified the /etc/skel template before creating the users.