I'm struggling with this script, I have tried different thing but I can't get it to work.
I tried with if ,doesn't work, I tried with nested while also without success. I don't know what to do any more...
If the value imax has reached 10 i want it to start over with 1
this is the code:
folder="f"
ps=20000
name="test"
i=1
imax=1
while [ $i -le 20 ]
do
cd
cd "$folder$((i))"
sed -i 1s/.*/$name$((imax))/ file.txt
sed -i 2s/.*/$ps/ file.txt
(( i++ ))
(( imax++ ))
done
Thank you