A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

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.

for f in $FOLDERS
echo "$f"
if [[ -d "${f}" [[ ; then
echo "WOHOO its there"
echo ""
echo "Bummer no path like that."
echo ""

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.

Click Here!