Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Variable fails to increment with lvalue error
- X-seq: zsh-users 29312
- From: Evan Clearfield <efclear@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Variable fails to increment with lvalue error
- Date: Mon, 23 Oct 2023 11:27:50 -0400
- Archived-at: <https://zsh.org/users/29312>
- List-id: <zsh-users.zsh.org>
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