guess what i'm new to scripting
I have this assignment for shool and i'm stuck for hours now and clueless.
So if anyone could help me out, put me on the right track.
What i want to do is make a list for the current directory, then checking if it already exists if so ask the user if he wan'ts to overwrite, if no go back, if yes, overwrite the file.
At last if the file doesn't exist i want to create it and fill it up with the list from the directory.
This is how i failed
if [ -e dirdump.dmp ]; then
echo " The file already exists , overwrite? y/n "
read input
if [$input == "n"]; then
break
elif ["$input" = "y"]; then
ls >> dirdump.dmp
fi
else
ls >> dirdump.dmp
echo -n "U dump is aangemaakt en vind u terug in : "
pwd
fi
I get the following error: script.sh: 15 [y: not found
This is when i choose to type y.
Anyone?