Suppose you have a variable below how would you increment that variable by 1 in Bash


You can use

let x++

If we want to loop through a number of items while incrementing the x variable, we can use the for loop below:

for name in Lisa Lilly Lousa ; do echo $x $name ; let x++ ; done