i have whrite this to learn a bit shell scripting, but now theres a mistake in it and i cant figure it out... (sry my english is very bad xD)

here is my script:

#!/bin/sh


echo "This Programm will help u create, delete and coppy Directories and Files."
echo "What do u want to make? (c)reate, (d)elete or c(o)ppy?: " ; read Choise
if [ $Choise = "c" ]
then
echo "Do u want to create a (f)ile or (d)irectory?: " ; read Choise2
if [ $Choise2 = "f" ]
then
echo "Enter the Name for your File u want create: " ; read Name
echo "Insert the Path, where u want to save your File: " ; read Path
touch $Path/$Name
echo "Your File has been created in $Path, do u want to change Permission(example:755)?: (y/n) " ; read Perm
if [ $Perm = "y" ]
then
echo "Which Permission u want?: " ; read Permi
chmod $Permi $Path/$Name
echo "$Path/$Name has been changed to mod $Permi!"
else
echo "gl & hf"
fi
elif [ $Choise2 = "d" ]
then
echo "Enter the Name for the Directory u want to create: " ; read Dirn
echo "Insert the Path where u want to create your Directory: " ; read Dirp
mkdir $Dirp/$Dirn
echo "$Dirn has been created in $Dirp!"
else
echo "gl & hf"
fi
elif [ $Choise = "d" ]
then
echo "Do u want to delete a (f)ile or (d)irectory?: " read Choise3
if [ $Choise3 = "f" ]
then
echo "Enter the full Path+Name of the file u want to delete: (example: /usr/home/peter/hugo will delete you file hugo) " ; read Fpath
rm $Fpath
echo "$Fpath has been deleted"
elif [ $Choise3 = "d" ]
then
echo "Do u want to delete a Directory which has Subdirectorys or Files, or is it empty?"
echo "(f)ull, or (e)mpty Directory?: " ; read Dirch
if [ $Dirch = "f" ]
then
echo "W A R N I N G !!! This will delete your Directory u choose complete with all Subdirectorys and Files!!!!"
echo "Enter the full Path from the Directory u want to delete complete with all SUBDIRECTORYS AND SUBFILES!"
echo "example: /usr/home/peter/hugo will delete the Directory Hugo with ALL SUBS!!: " ; read Delsd
rm -r $Delsd
echo "$Delsd has been completly deleted inclusive its SUBS!"
elif [ $Dirch = "e" ]
then
echo "Enter the full Path of the EMPTY Directory u want delete: "
echo "example: /usr/home/peter/hugo will delete the empty Directory Hugo!" ; read Deled
rmdir $Deled
echo "$Deled has been deleted!"
else
echo "wrong choise"
fi
else
echo "wrong choise"
fi
elif [ $Choise = "o" ]
then
echo "Do u want to coppy a Directory with Subdirectorys/files? or do u want to copy an single Directory/File?
echo "Choose: (s)ingle (w)ith Subs" ; read Cop
if [ $Cop = "s" ]
then
echo "Enter the full Path of your single File/Directory u want to coppy: "
echo "example: /usr/home/peter/hugo coppy the single File/Directory Hugo!" ; read Copp
echo "Enter the full Path where u want to coppy your single File/Directory: "
echo "example: /usr/home/peter/ will coppy Hugo in this Path!" ; read Copwp
cp $Copp $Copwp
echo "$Copp has been coppyed to $Copwp!"
elif [ $Cop = "w" ]
then
echo "Enter the full Path of your Directory u want to coppy without / at the end: "
echo "example: /usr/home/peter/hugo will coppy the Directory Hugo with all SUBdirectorys/files!!" ; read Wits
echo "Enter the full Path (without / at the end) where u want to coppy your Directory inclusive the SUBdirectorys/files: "
echo "example: /root will coppy your Directory with all SUBS into /root!" ; read Wips
cp -r $Wits $Wips
echo "$Wits has been coppyed with all SUBS into $Wips!"
else
echo "gl & hf"
fi
else
echo "gl & hf"
fi


i hope u can read it (its my first post here and i coppyed with winVMS)
when u can tell me where is my problem i would be verry thankful

mfg peter

Recommended Answers

All 2 Replies

We could use a little more information.

Do you get an error message when you run it?

What is it suppossed to do, and what does it actually do?

hi,
i want to write a scrip which can analyze a print command and display its ,lets say 11th and 12th line only....can u plz help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.