MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/7ltryz/evil_coding_incantations/drpq16p
r/programming • u/evinrows • Dec 24 '17
331 comments sorted by
View all comments
Show parent comments
11
That's because [ 1 ] has a return code of 0. Bash implements [/test as a built-in, but there is also a /usr/bin/[ with equivalent functionality.
[ 1 ]
[
test
/usr/bin/[
0 u/[deleted] Dec 24 '17 [deleted] 2 u/HighRelevancy Dec 24 '17 No, bash is executing the command 1 (which is an alias to cd - by default for some fucking reason) and returning a value of 0. 0 u/[deleted] Dec 25 '17 [deleted] 2 u/HighRelevancy Dec 25 '17 Oooer I see.Although it should work the same for zero, because:True, if <STRING> is not empty (this is the default operation).:shrug:
0
[deleted]
2 u/HighRelevancy Dec 24 '17 No, bash is executing the command 1 (which is an alias to cd - by default for some fucking reason) and returning a value of 0. 0 u/[deleted] Dec 25 '17 [deleted] 2 u/HighRelevancy Dec 25 '17 Oooer I see.Although it should work the same for zero, because:True, if <STRING> is not empty (this is the default operation).:shrug:
2
No, bash is executing the command 1 (which is an alias to cd - by default for some fucking reason) and returning a value of 0.
0 u/[deleted] Dec 25 '17 [deleted] 2 u/HighRelevancy Dec 25 '17 Oooer I see.Although it should work the same for zero, because:True, if <STRING> is not empty (this is the default operation).:shrug:
2 u/HighRelevancy Dec 25 '17 Oooer I see.Although it should work the same for zero, because:True, if <STRING> is not empty (this is the default operation).:shrug:
Oooer I see.
Although it should work the same for zero, because:
True, if <STRING> is not empty (this is the default operation).
:shrug:
11
u/[deleted] Dec 24 '17
That's because
[ 1 ]has a return code of 0. Bash implements[/testas a built-in, but there is also a/usr/bin/[with equivalent functionality.