The following line creates file_c-6.txt but outputs 5:$ i=5; ls file_a-${i}.txt file_b-${i}.txt > file_c-$(( ++i )).txt; echo $i5$ cat file_c-6.txtfile_a-5.txtfile_b-5.txtIf one removes > it would list file_c-6.txt and output 5:I can't understand why it doesn't keep the value of i in the first example.$ i=5; ls file_a-${i}.txt file_b-${i}.txt file_c-$(( ++i )).txt; echo $ifile_a-5.txt  file_b-5.txt  file_c-6.txt6
evaluation of arithmetic expansion in bash
bash