May 12, 2011

Bash scripting assistance needed please.

Hey there Guys / Girls,

I am busy doing 100 different things and configurations on one of my systems and as such I have had places where folders and paths were not existing / missing.

So I wrote this little guy to let me know.

FOLDERS="/u01/stuffs/data
/u01/stuffs/music
/u01/stuffs/information"
for f in $FOLDERS
do
echo "$f"
if [[ -d "${f}" [[ ; then
echo "WOHOO its there"
echo ""
fi
echo "Bummer no path like that."
echo ""
done

Now I am adding it to a little bash applet where it will load various things. one being this script. BUT heres the issue.

How can i get the FOLDERS variable to read from a file.
so for instance have a folders.txt with all the paths listed in it, then my variable Folders will just be a read of that entire file.

everywhere i can find something they are always read 1 line to 1 variable, and thats where im stuck, I would like to keep it 1 variable. somehow.......

Thanks for any assists.