Bash script to delete folder based on text file information

I have been working on a script to list all the name's of a subfolder in a text file then edit that text file and then delete the subfolder base on the edited text file so far I have been able to do every thing I just talked about but can't figure out how to delete the subfolers base on a text file I am new to linux and just learning so if anyone good help me out I would sure appreciated it.

#!/bin/bash
cd /month
folders=$(ls)
echo "$folders" > /file.txt
cat file.txt | \
sed -e s/time1//g -e s/time189//g > customer.txt
rm /file.txt

???
Dont understand much...
You wish to remove a directory (or subdir.) ? If so you would use rmdir, but it has to be empty... The other alternative is rm -rf (man rm rmdir)

Ok I am trying to do a rm -rf for every folder that is listed in my customer.txt so let's say that text file has 3 folder names in it: folder1, folder2,folder3 I want to delete those folder with a rm -rf but the problem is I don't know how to go about this.

Why don't you do
for $i in somefolder/*
do
case $i in
folder1|folder2|folder3)
rm -rf $i
;;
*)
;;
esac
done

I don't understand where you are getting the $1 variable from and I don't understand what the folder1|folder2|folder3 is for if you don't care can you break it down for me or point me to some tutorials.

This is very simple.. really..

#!/bin/bash

for file in `cat customer.txt`; do
    # -f is for force
    # -r is for recursive
    # -v is for verbose so you can see what it is doing
    rm -rfv $file
done

When I run that script it delete's the customer.txt file and it don't delete the folder's
#!/bin/bash

for file in `cat customer.txt`; do
# -f is for force
# -r is for recursive
# -v is for verbose so you can see what it is doing
rm -rfv $file
done

I tested the code before I showed you. I have also extended the code greatly to prove that it works. Below is the code, and below that is the text that it outputs. Did you test the code before you responded, or did you just think it deleted the customer.txt file? What was the output of the script when you ran it? It should output what it is deleting (because of the -v in rm).

#!/bin/bash

files=$(cat customer.txt);

echo "Current directory listing";
echo "-------------------------";
find . -maxdepth 1 -exec echo -e "\t" '{}' \;
echo
echo "Files listed in customer.txt"
echo "--------------------------";
echo -e "\t" $files;
echo
echo "Removing files now.";
echo "--------------------------";
for file in `cat customer.txt`; do
        rm -rvf $file;
done
echo "Removal complete";
echo "--------------------------";
echo
echo "Files now in directory";
echo "--------------------------";
find . -maxdepth 1 -exec echo -e "\t" '{}' \;
-bash-3.00$ ./rmsc.sh
Current directory listing
-------------------------
         .
         ./test10
         ./test8
         ./test7
         ./test3
         ./test.sh
         ./test5
         ./test6
         ./test1
         ./rmsc.sh
         ./test9
         ./customer.txt
         ./test2
         ./test4

Files listed in customer.txt
--------------------------
         test1 test2 test3 test4 test5 test6 test7 test8 test9

Removing files now.
--------------------------
removed directory: `test1'
removed directory: `test2'
removed directory: `test3'
removed directory: `test4'
removed directory: `test5'
removed directory: `test6'
removed directory: `test7'
removed directory: `test8'
removed directory: `test9'
Removal complete
--------------------------

Files now in directory
--------------------------
         .
         ./test10
         ./test.sh
         ./rmsc.sh
         ./customer.txt

$i contain the list of files and directories in directory somedir/. With case you can specify the exact name of folders you want to delete (in my example folders folder1,2,3 will match case statement and will be deleted). I've missed check statement to be sure that we delete the folder.