Skip to main content
21 events
when toggle format what by license comment
Apr 12, 2022 at 17:38 comment added dc46and2 Thanks for the great summary of the differences (although I disagree with the recommendation.) Another important difference: the arguments to binary operators such as -eq are evaluated as arithmetic expressions when used with [[. E.g. try [[ 2 -eq "1 + 1" ]] or [[ 10 -eq 0xA ]].
Mar 2, 2022 at 19:00 comment added jfernandz So impressive ...
Mar 16, 2021 at 20:40 history edited Ciro Santilli OurBigBook.com CC BY-SA 4.0
added 3 characters in body
Feb 13, 2021 at 19:32 history edited Ciro Santilli OurBigBook.com CC BY-SA 4.0
added 90 characters in body
Jan 13, 2021 at 8:32 comment added Ciro Santilli OurBigBook.com @tgm1024--Monicawasmistreated yes, that is also a valid consideration.
Jan 13, 2021 at 0:04 comment added tgm1024--Monica was mistreated It seems to me that using [[ (instead of [) is well worth losing portability in most cases. Anything to avoid excess escaping increases shell readability, and hence reduces bugs. Shell code is already so muddled up that there are routinely errors centered around whether or not something needs one backslash or two, and anything that mitigates the likelihood of saying "WTF just happened here" is a win.
Jan 6, 2021 at 9:01 comment added Ciro Santilli OurBigBook.com @GordonDavisson thanks, I didn't know that, fixed.
Jan 6, 2021 at 9:00 history edited Ciro Santilli OurBigBook.com CC BY-SA 4.0
deleted 42 characters in body
Jan 5, 2021 at 5:07 comment added Gordon Davisson Correction: ] is an argument to the [ command, but it doesn't prevent further arguments from being used. ] must be the last argument to [, but it can also occur as part of the test expression. For example, if [ "$foo" = ] ]; then will test whether the variable foo is set to "]" (as will if [ ] = "$foo" ]; then).
Jun 4, 2019 at 7:25 comment added Jonathan Komar See man test if you tried man [ and got lost. That will explain the POSIX variant.
Feb 5, 2019 at 11:10 history edited Stéphane Chazelas CC BY-SA 4.0
added 100 characters in body
Feb 5, 2019 at 11:04 history edited Stéphane Chazelas CC BY-SA 4.0
added 100 characters in body
Feb 5, 2019 at 10:51 history edited Stéphane Chazelas CC BY-SA 4.0
added 679 characters in body
Feb 5, 2019 at 9:11 comment added Ciro Santilli OurBigBook.com @StéphaneChazelas thanks for the info! I've addedexpr to the answer. The term "Bash extension" is not meant to imply Bash was the first shell to add some syntax, learning POSIX sh vs Bash is already enough to drive me crazy.
Feb 5, 2019 at 9:08 history edited Ciro Santilli OurBigBook.com CC BY-SA 4.0
added 2 characters in body
Feb 5, 2019 at 8:53 history edited Ciro Santilli OurBigBook.com CC BY-SA 4.0
added 19 characters in body
Feb 5, 2019 at 8:13 history edited Ciro Santilli OurBigBook.com CC BY-SA 4.0
added 89 characters in body
S Apr 15, 2018 at 15:41 history edited G-Man Says 'Reinstate Monica' CC BY-SA 3.0
Improved formatting.
Apr 15, 2018 at 14:49 review Suggested edits
S Apr 15, 2018 at 15:41
Apr 6, 2018 at 1:02 history edited Ciro Santilli OurBigBook.com CC BY-SA 3.0
added 169 characters in body
Nov 30, 2017 at 15:09 history answered Ciro Santilli OurBigBook.com CC BY-SA 3.0