zsh-users
 help / color / mirror / code / Atom feed
From: sergio <sergio@outerface.net>
To: zsh-users@zsh.org
Subject: Arithmetic Zero
Date: Tue, 5 Mar 2024 06:28:04 +0300	[thread overview]
Message-ID: <47117922-e17f-44d1-8a2f-2cb4a9c53606@outerface.net> (raw)


I believe -e is best practices for scripts, so have:

```
#!/bin/zsh -e
(( test = 0 ))
echo $test
```

and it doesn't work of course.

1. What is the reason for returning 1 when an arithmetic evaluation 
succeeds but is zero?

2. How to do arithmetic evaluation properly in zsh sripts? postpend with 
  || true

-- 
sergio.


             reply	other threads:[~2024-03-05  3:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  3:28 sergio [this message]
2024-03-05  4:23 ` Bart Schaefer
2024-03-05  5:02   ` Lawrence Velázquez
2024-03-05  7:09   ` Stephane Chazelas
2024-03-05  7:26 ` Roman Perepelitsa

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=47117922-e17f-44d1-8a2f-2cb4a9c53606@outerface.net \
    --to=sergio@outerface.net \
    --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).