listing folders and using in script

im a bit new to this and have been playing quite a bit and cant figure it out :frowning:

I have made a basic script:

cd /folder/software1/bin/;
echo "software1," >> /in/local/var/trace/davescripts/software.txt  "\c";
ls -tm >> /in/local/var/trace/davescripts/software.txt;

and this basically repeats for software2, software3 and so on. However I need to run this on multiple boxes all with different software names so really want to be able to go into /folder/ (all software folders are in this folder) run a ls and then loop the rest using the output of ls.

Any ideas on how this can be done?

ok new development lol

#!/bin/sh
for i in `cat /in/local/var/trace/davescripts/list.txt`
do
cd /service/$i/bin/;
echo $i >> /in/local/var/trace/davescripts/software.txt  "\c";
ls -tm >> /in/local/var/trace/davescripts/software.txt;
done

So now i'm putting a ls into a file called list.txt and trying it that way...it works :smiley: