hey all. Im writing a small script that is supposed to check for a file or directory and when its not there create it. After it creates the file or directory I would like the script to loop to the beginning but I cant figure it out. What am I doing wrong? Here is my script that works.
#!/bin/bash
# Michael Duquette, Edward Correa, Paul Crew, Arthur Cramer
# Checks to see if directory exists and if not creates the directory
echo -e "Please Enter the directory you wish to create: "
read dir
if [ ! -d ./$dir ]
then
mkdir ./$dir
echo -n "The directory "
echo -n "$dir"
echo -n " has been created. "
else
echo -n "I am sorry "
echo -n "$dir"
echo -n " already exists."
fi
Any help would be greatly appreciated. We havent learned loops in UNIX but I have in JAVA but I cant get it to work. This script doesnt require a loop but I believe it would be easier than initalizing it over and over again. Thanks alot.