Create BASH script to process multiple inputs on read
First post from a very new Linux user....I am trying to create a BASH script that will allow user to provide multiple directory names, Checks if the directory exists and if not create the directory. I am using the following code:
CreateFolder()
{
echo "Enter the name(s) of the folder you would like to create."
read directory
if [ -d $directory ]; then
echo "Directory $directory exists"
else
mkdir $directory
fi
}
which works fine as long as the user enters a single directory name. How can I modify this so it will process all directory names user enters on the read response?
Thanks for your help.
|