I have a C code and I use it to extract file and write in to separate files such as exax0.txt, ..., exax202.txt. To do that I use
for i in $(seq 0 202);
do echo $i | ./f.out exa-NO-hyp.bin exax${i}.txt <<< "${i}"
done
Instead, I would like to have my output files named as exax495.txt, exax535.txt, ..., exax8545.txt. To do so, I tried something like:
for i in $(seq 0 202);
do echo $i | ./f.out exa-NO-hyp.bin exax${(i*40+495)}.txt <<< "${i}"
done
But it says, -bash: exax${i*40}.txt: bad substitution
Can anybody please help me with this?
echo "$i" | program ... <<< "$i"is wasting the pipe. The input ends up coming from the here string. Drop theecho "$i" |part../f.out exa-no-hyp.bin exa${filenumber}.txt.