I know that there are use cases for [ ] over [[ ]]. There have to be. Why in god’s name would [ ] exist if there wasn’t a reason to use it over [[ ]]? I’m obviously the one in the wrong by only ever using [[ ]], because [ ] would definitely be better in some type of situations that I’m just not seeing clearly. Right???
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: !programmerhumor@lemmy.ml
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.
I know that there are use cases for [ ] over [[ ]]. There have to be. Why in god’s name would [ ] exist if there wasn’t a reason to use it over [[ ]]? I’m obviously the one in the wrong by only ever using [[ ]], because [ ] would definitely be better in some type of situations that I’m just not seeing clearly. Right???
I believe the reason is that bash is backwards compatible with sh and sh only has [ ], not [[ ]]
Solution: fuck backwards compatibility and use fish
Fish is starting to get more POSIX compliant as of late, the error redirect is no longer
^ /dev/null
but2>/dev/null
Fish might be good for interactivity, but in terms of scripting, just go straight to python. It’s not worth it.
[
is a binary (sometimes a symlink) in/usr/bin
. It’s/usr/bin/[
🤓[[ is not a POSIX shell feature.