I want to edit a bunch of files with a bash script. First I need the single path to the file as well as a counter. So far I came up with this:
let n=0
array=(`pwd`"/worker/worker*/conf/logfilefilter-worker*.xml")
for i in "${array[@]}"; do
let "c += 1"
echo $i
echo $c
# here comes the edit stuff.
done
But this loop just runs once:
[mles@sagnix etl-i_test]$ ./iprog_new --test
/home/devel/mles/etl-i_test/worker/worker01/conf/logfilefilter-worker01.xml /home/devel/mles/etl-i_test/worker/worker02/conf/logfilefilter-worker02.xml /home/devel/mles/etl-i_test/worker/worker03/conf/logfilefilter-worker03.xml /home/devel/mles/etl-i_test/worker/worker04/conf/logfilefilter-worker04.xml /home/devel/mles/etl-i_test/worker/worker05/conf/logfilefilter-worker05.xml /home/devel/mles/etl-i_test/worker/worker06/conf/logfilefilter-worker06.xml /home/devel/mles/etl-i_test/worker/worker07/conf/logfilefilter-worker07.xml /home/devel/mles/etl-i_test/worker/worker08/conf/logfilefilter-worker08.xml
1
How will the loop run one by one trough the files?