Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Variable fails to increment with lvalue error



I’m in the process of creating a shell script on macOS Sonoma. I’m just implementing a simple counter in a for loop. I initialized my variable outside the loop, such that “count=0”. I then increment it with a simple call “(($count++))”, and when I run the script, I receive the error “bad math expression: lvalue required”

Any idea what I’m doing wrong? I’ve searched high and low, tried multiple variations of the “((count++))” expression, changed my initial number, etc. Nothing seems to work.

HELP
Sent from my iPhone



Messages sorted by: Reverse Date, Date, Thread, Author