for loop with multiple conditions in Bash scripting
问题 It's been a while since I've done intense bash scripting and I forgot the syntax for doing multiple conditions in a for loop. In C, I'd do: for(var i=0,j=0; i<arrayOne.length && j<arrayTwo.length; i++,j++){ // Do stuff } I've been googling for a while and have only found syntax involving nested for loops, not multiple conditions to one for loop. 回答1: Sounds like you're talking about the arithmetic for loop . for ((i = j = 0; i < ${#arrayOne[@]} && j < ${#arrayTwo[@]}; i++, j++)); do # Do