GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Juno (jutty@mastodon.bsd.cafe)'s status on Tuesday, 30-Apr-2024 04:48:05 JST Juno Juno

    After a while trying to understand if either ksh or zsh provided a way to prevent taking strings and undefined variables as 0 when doing arithmetic evaluation, there seems to be no feature specifically for it, sadly.

    Closest is using set -o nounset (ksh) and setopt no_unset (zsh) to prevent undefined variables from evaluating to zero. If a "string" contains only numbers, a dot and whitespace, it will be treated as a number. Also, if it only contains the name of any other variable and whitespace, it evaluates to that.

    Not that I expected shell languages to provide accurate arithmetic.

    As a bonus though, it was cool learning about ksh's compound variables, force_float option and especially discipline functions.

    #ksh #zsh #shell #programming

    In conversation about a year ago from mastodon.bsd.cafe permalink

    Attachments


    Feeds

    • Activity Streams
    • RSS 2.0
    • Atom
    • Help
    • About
    • FAQ
    • TOS
    • Privacy
    • Source
    • Version
    • Contact

    GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

    Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.