this post was submitted on 02 Oct 2023
1751 points (98.0% liked)

Programmer Humor

32412 readers
676 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] hisbaan@lemm.ee 11 points 1 year ago (2 children)

I believe the reason is that bash is backwards compatible with sh and sh only has [ ], not [[ ]]

[โ€“] float@feddit.de 6 points 1 year ago

[ is a binary (sometimes a symlink) in /usr/bin. It's /usr/bin/[ ๐Ÿค“

[โ€“] Number358@lemmy.world 5 points 1 year ago (2 children)

Solution: fuck backwards compatibility and use fish

Fish might be good for interactivity, but in terms of scripting, just go straight to python. It's not worth it.

[โ€“] Cysioland@lemmygrad.ml 3 points 1 year ago

Fish is starting to get more POSIX compliant as of late, the error redirect is no longer ^ /dev/null but 2>/dev/null