Pricefield | Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
☆ Yσɠƚԋσʂ ☆ to Programmer [email protected]English • 4 months ago

Like programming in bash

lemmy.ml

message-square
25
fedilink
  • cross-posted to:
  • [email protected]
189

Like programming in bash

lemmy.ml

☆ Yσɠƚԋσʂ ☆ to Programmer [email protected]English • 4 months ago
message-square
25
fedilink
  • cross-posted to:
  • [email protected]
  • @[email protected]
    link
    fedilink
    3•4 months ago

    You could write that as 1 line:

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

    • Oriel Jutty :hhHHHAAAH:
      link
      fedilink
      4•4 months ago

      @Tangentism @Ephera Did you mean:

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

      ?

    • Oriel Jutty :hhHHHAAAH:
      link
      fedilink
      6•4 months ago

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

Programmer [email protected]

[email protected]
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.
  • 1 user / day
  • 80 users / week
  • 455 users / month
  • 1.54K users / 6 months
  • 4 subscribers
  • 1.82K Posts
  • 38.5K Comments
  • Modlog
  • mods:
  • @[email protected]
  • @[email protected]
  • UI: 0.18.4
  • BE: 0.18.2
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org