this post was submitted on 05 Mar 2025
187 points (99.5% liked)
Programmer Humor
34449 readers
104 users here now
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.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
You could write that as 1 line:
[ -z "$var" ] && echo "empty" || echo "no it aint"
Incidentally, this is an anti-pattern: http://mywiki.wooledge.org/BashPitfalls#cmd1_.26.26_cmd2_.7C.7C_cmd3
@Tangentism @Ephera Did you mean:
?