▲ 195 ▼ Like programming in bash (lemmy.ml) submitted 2 years ago by yogthos@lemmy.ml to c/programmerhumor@lemmy.ml 25 comments fedilink hide all child comments
[–] Tangentism@lemmy.ml 3 points 2 years ago (2 children) You could write that as 1 line: [ -z "$var" ] && echo "empty" || echo "no it aint" permalink fedilink source parent hideshow 2 child comments replies: [–] barubary@infosec.exchange 6 points 2 years ago Incidentally, this is an anti-pattern: http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3 permalink fedilink source parent [–] barubary@infosec.exchange 4 points 2 years ago @Tangentism @Ephera Did you mean: echo "${var:-empty}${var:+no it aint}" ? permalink fedilink source parent
[–] barubary@infosec.exchange 6 points 2 years ago Incidentally, this is an anti-pattern: http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3 permalink fedilink source parent
[–] barubary@infosec.exchange 4 points 2 years ago @Tangentism @Ephera Did you mean: echo "${var:-empty}${var:+no it aint}" ? permalink fedilink source parent