Linux/UNIX Bash Shell Script trouble help needed!!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

[b]2. Shell Bash Script

[b]3.

 !/bin/bash
if [ ! -d /home/AC_Drywall]
   echo no directory 
then 
	mkdir -p /home/AC_Drywall
elif [ ! -d ]; then
   echo "$dir already exist"
fi

[b]4. Gwinnett Tech College / CIST 1520 Scripting Technologies / Shane Archibald

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

I'm totally lost on what the code suppose to look like on this project:

The Antonio Czechos Drywall Firm has hired you to help implement a directory structure for them based on Figure 5-19. Because you were called out of town to aid another customer, you cannot go to the site. In the meantime, you decide to write a script that will create the structure for them. To create the directory structure, complete the following tasks:

Helllllllllllllllllllllllp!!! :eek:

---------- Post updated at 01:12 PM ---------- Previous update was at 12:42 PM ----------

So this the code I wrote completely but i believe it's wrong

!/bin/bash
if [ ! -d /home/AC_Drywall]
then
   echo no directory 
then 
	mkdir -p /home/AC_Drywall
elif [ ! -d ]; then
   echo "$dir already exist"
fi   
if [ ! -d /home/AC_Drywall/MIS/Production/Marketing]
then
	echo no directory
then
	mkdir -p /home/AC_Drywall/MIS/Production/Marketing
elif [ ! -d ]; then
	echo "dir already exist"
fi
if [ ! -d /home/AC_Drywall/MIS/Project1/work1.doc/work2.doc]
then
	echo no directory
then
	mkdir -p /home/AC_Drywall/MIS/Project1/work1.doc/work2.doc
elif [ ! -d ]; then
	echo "dir already exist"
fi
if [ ! -d /home/AC_Drywall/Production/Shift1/Shift2/Shift3]
then
	echo no directory
then
	mkdir -p /home/AC_Drywall/Production/Shift1/Shift2/Shift3
elif [ ! -d ]; then
	echo "dir already exist"
fi
if [ ! -d /home/AC_Drywall/Production/Shift1/.manager1.txt/emp1.txt]	
then
	echo no directory
then
	mkdir -p /home/AC_Drywall/Production/Shift1/.manager1.txt/emp1.txt
elif [ ! -d ]; then
	echo "dir already exist"
fi
if [ ! -d /home/AC_Drywall/Marketing/Sales/Admin]
then
	echo no directory
then
	mkdir -p /home/AC_Drywall/Marketing/Sales/Admin
elif [ ! -d ]; then
	echo "dir already exist"
fi
if [ ! -d /home/AC_Drywall/Marketing/Sales/East/West]
then
	echo no directory
then
	mkdir -p /home/AC_Drywall/Marketing/Sales/East/West
elif [ ! -d ]; then
	echo "dir already exist"
fi

Adding "helllllllllllllp!!!!11/1/1./1one" to a post never helps. Don't do it.

Since you're using mkdir -p, you don't need to check if a directory already exists. It will work fine if it does already, and return error if it can't make any of the directories. Much less repetition.

if ! mkdir -p /path/to/dir1 /path/to/dir2 /path/to/dir3 /path/to/dir4 ...
then
        echo "Couldn't create directories"
        exit 1
fi

Hint: read the mkdir manual. The -p option will not overwrite existing directories.

Thx Corona688
I'm extremely new to the script writing and just don't get it but I'm putting it together. I understand the "echo "dir already exist" thx I will make that change. But i'm not understanding the "exit 1"

An are you saying I could've wrote

if ! -d /home/AC_Drywall/MIS/Production/Marketing /home/AC_Drywall/MIS/Project1/......

all on one line and it would've created all of them with out doing it over and over again.

I don't know what you're talking about, I didn't mention that.

It means, quit the script early with an error code. All programs return a number when they quit. Zero means success. Nonzero means failure of some sort. 'if' statements use these codes.

No, I'm saying you could've done:

if ! mkdir -p /path/to/dir1 /path/to/dir2 /path/to/dir3 /path/to/dir4 ...
then
        echo "Couldn't create directories"
        exit 1
fi

...and it would create them all without going through it over and over again.

You don't need -d at all. mkdir -p checks for you.

You can put any command in an if-statement, mkdir included. Any command returns an error code.