Blåhaj Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 3 months ago

Like programming in bash

lemmy.ml

message-square
8
link
fedilink
  • cross-posted to:
  • wwwopera@lemm.ee
  • programmer_humor@programming.dev
184

Like programming in bash

lemmy.ml

☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 3 months ago
message-square
8
link
fedilink
  • cross-posted to:
  • wwwopera@lemm.ee
  • programmer_humor@programming.dev
alert-triangle
You must log in or register to comment.
  • 𝘋𝘪𝘳𝘬@lemmy.ml
    link
    fedilink
    arrow-up
    12
    ·
    3 months ago

    I gave up Bash scripting. I explicitly do “shell scripting” now, where “shell” is implied to be a POSIX compliant shell of any type.

    • fallingcats@discuss.tchncs.de
      link
      fedilink
      arrow-up
      7
      ·
      3 months ago

      But, but like … hear me out.

      echo $((1+1))

      • 𝘋𝘪𝘳𝘬@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        3 months ago

        That is a posixly correct method to do arithmetic expressions.

        • fallingcats@discuss.tchncs.de
          link
          fedilink
          arrow-up
          1
          ·
          3 months ago

          Huh, seems you’re right. I was under the impression this wouldn’t work in dash but apparently that’s wrong.

          • 𝘋𝘪𝘳𝘬@lemmy.ml
            link
            fedilink
            arrow-up
            1
            ·
            3 months ago

            Yep! The functionality for performing arithmetic expressions this way is called “arithmetic expansion”.

            2.6.4 Arithmetic Expansion

            Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its value. The format for arithmetic expansion shall be as follows:

            $((expression))

            The expression shall be treated as if it were in double-quotes, except that a double-quote inside the expression is not treated specially. The shell shall expand all tokens in the expression for parameter expansion, command substitution, and quote removal.

            Next, the shell shall treat this as an arithmetic expression and substitute the value of the expression. […]

            https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_04

  • CapriciousDay@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    8 days ago

    deleted by creator

  • adr1an@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    3 months ago

    Will anyone acknowledge the fact that you only learn to ride a bike once? To me, the saying “is like riding a bike” means the opposite…

    • Ad4mWayn3@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      3 months ago

      Read the post again lol

      • adr1an@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        3 months ago

        OH!

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 176 users / day
  • 1.78K users / week
  • 2.99K users / month
  • 9.2K users / 6 months
  • 602 local subscribers
  • 35.9K subscribers
  • 1.72K Posts
  • 34.6K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.11
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org