To find ls of similar pattern files in a directory by passing the variable.

Hi,

I have file in my $datadir as below :-

SAT_1.txt
SAT_2.txt
BAT_UD.lst
BAT_DD1.lst
DUTT_1.txt
DUTT_la.txt

Expected result :-
should get all the above file in $<Filename>_file.lst

Below is my code :-

 
for i in SAT BAT DUTT
do
touch a.lst
cd $datadir
ls -1 $i_* >> $i_file.lst
done

problem :-
ls -1 $i_* is getting read as ls -1 *

Am i missing anything ..Plz help me out.

Thanks inn advance.

Regards,
Satish.

try with

ls -l ${i}_*>> $i_file.lst