zsh-users
 help / color / mirror / code / Atom feed
From: Evan Clearfield <efclear@gmail.com>
To: zsh-users@zsh.org
Subject: Variable fails to increment with lvalue error
Date: Mon, 23 Oct 2023 11:27:50 -0400	[thread overview]
Message-ID: <F6518D8B-3EE2-4552-89CA-035CD50226A3@gmail.com> (raw)

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

             reply	other threads:[~2023-10-23 15:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 15:27 Evan Clearfield [this message]
2023-10-23 15:33 ` Roman Perepelitsa
2023-10-23 16:43   ` Peter Stephenson
2023-10-23 17:03     ` Roman Perepelitsa
2023-10-23 18:21       ` Ray Andrews
2023-10-23 16:34 ` Dominik Vogt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F6518D8B-3EE2-4552-89CA-035CD50226A3@gmail.com \
    --to=efclear@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).