2
rated 0 times
[
2]
[
0]
/ answers: 1 / hits: 11081
/ 3 Years ago, tue, july 6, 2021, 3:11:26
#!/bin/bash
cd /pg
file=`ls -l |awk '{print $9}'`
list=()
for i in $a
do
echo $i
a=`cat /pg/$i | head -n 1 |awk '{print $8}' ` #output: first interation 15 & 2nd values 60
list+=($a)
#a1=`cat /pg/$i | head -n 2 |awk '{print $8}'`
done
echo $list
through this a=`ls -l |awk '{print $9}'`
I'm getting two file and iterating through for loop
and appending values to list() the list should contains "15","16" but list contains only one value is "15"
Please help me to fix the same.
More From » bash