emanuele6 1666283819 learn cmd arg > "file$(( i++ ))" -- Redirection for simple commands may be ran in a subshell, so value the value of $i may not change in a subshell, you can use { cmd arg ;} > "file$(( i++ ))" or file=file$(( i++ )); cmd arg > "$file" instead. This is also problematic when using > "$BASHPID", or > "${foo=bar}". See . emanuele6 1666283934 forget emanuele6 1666283977 learn cmd arg > "file$(( i++ ))" -- Redirections for simple commands may be ran in a subshell, so the value of $i may not change in the main shell, you can use { cmd arg ;} > "file$(( i++ ))" or file=file$(( i++ )); cmd arg > "$file" instead. This is also problematic when using > "$BASHPID", or > "${foo=bar}". See . emanuele6 1666301957 forget emanuele6 1666302103 learn cmd arg > "file$(( i++ ))" -- Redirections for simple commands may be run in a subshell, so the value of $i may not change in the main shell. Use { cmd arg ;} > "file$(( i++ ))" or file=file$(( i++ )); cmd arg > "$file" instead. This can also cause problems when using > "$BASHPID", or > "${foo=bar}". Also see and !pf 64.