spath="/home/user/k/${1}"
dpath="/home/user/seq/Nov17/${1}"
cd $dpath
ls -1 $spath > list
c=1
while read list
newlist=`echo $list | sed 's/.gz//' `
newnewlist=`echo $newlist | sed 's/.fastq//' `
do
echo $c
echo $list
c=$(($c+1))
done < list
The list has 96 lines but loop is going on and on. Please help
cd $dpath
c=1
newlist=`echo $list | sed 's/.gz//' `
newnewlist=`echo $newlist | sed 's/.fastq//' `
ls -1 $spath | while read LIST
do
echo "$c"
echo $LIST
c=$(($c+1))
done
Do you have a minute to write a line to help me know the reson.
redirecting output to a file and then opening the file and reading does not work.
but when I pipe ls output directly to the loop, it works.
I would say its not a good idea to use the same name for a variable and a file when you use both in the same script... (For me it was already confusing...) Then of course there is this syntax error: a while expects straight after a "do".... So try your script again and use capital letters for your variables (after placing correctly the "do"). Does it work?