Tim's Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 2 months ago

Like programming in bash

lemmy.ml

external-link
message-square
26
fedilink
  • cross-posted to:
  • [email protected]
193
external-link

Like programming in bash

lemmy.ml

☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 2 months ago
message-square
26
fedilink
  • cross-posted to:
  • [email protected]
  • Tangentism@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    2 months ago

    You could write that as 1 line:

    [ -z "$var" ] && echo "empty" || echo "no it aint"

    • Oriel Jutty :hhHHHAAAH:@infosec.exchange
      link
      fedilink
      arrow-up
      6
      ·
      2 months ago

      Incidentally, this is an anti-pattern: http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3

    • Oriel Jutty :hhHHHAAAH:@infosec.exchange
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      @Tangentism @Ephera Did you mean:

      echo "${var:-empty}${var:+no it aint}"
      

      ?

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: [email protected]

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.

  • 73 users / day
  • 548 users / week
  • 1.7K users / month
  • 10.5K users / 6 months
  • 1 local subscriber
  • 35.6K subscribers
  • 1.12K Posts
  • 13.6K Comments
  • Modlog
  • mods:
  • cat_programmer@lemmy.ml
  • UI: unknown version
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org