TheBonsai 1152123644 learn [ is NOT PART OF THE IF-SYNTAX. [ is a normal, ordinary COMMAND. the if-statement just checks the exit code of that command. So, it can check the exit code of every other command, too: if grep ^root /etc/passwd; then echo y0; else echo n0; fi :-P r00t 1172098118 forget r00t 1172098139 learn [ is NOT PART OF THE IF-SYNTAX. [ is a normal, ordinary COMMAND. the if-statement just checks the exit code of that command. So, it can check the exit code of every other command, too: if grep ^root /etc/passwd; then echo y0; else echo n0; fi - see help test for further usage of [ lhunath 1183327070 forget lhunath 1183327212 learn is NOT PART OF THE IF-SYNTAX. [ is a normal, ordinary APPLICATION. The if-statement just checks its exit code. See ''help test'' and http://wooledge.org/mywiki/BashGuide#Upgrade_Your_Tests lhunath 1183327291 forget lhunath 1183327333 learn is NOT PART OF THE IF-SYNTAX. [ is a normal, ordinary COMMAND. The if-statement just checks its exit code. See ''help test'' and http://wooledge.org/mywiki/BashGuide#Bash_Tests kojiro 1187287911 forget kojiro 1187287937 learn [ is NOT PART OF THE IF-SYNTAX. [ is a normal, ordinary COMMAND. The if-statement just checks its exit code. See ''help test'' and http://wooledge.org/mywiki/BashGuide#Bash_Tests igli 1202620314 forget igli 1202620413 learn [ is NOT part of the `if' syntax. [ is a normal, ordinary COMMAND. The if-statement just checks its exit code. See ''help test'', http://wooledge.org/mywiki/BashGuide#Bash_Tests and http://partmaps.org/era/unix/award-example-backticks.html greycat 1212525787 forget greycat 1212525789 learn is NOT part of the `if' syntax. It's a normal, ordinary COMMAND. The `if' just checks its exit status. See ''help test'', http://wooledge.org/mywiki/BashGuide/Practices/BashTests and http://partmaps.org/era/unix/award-example-backticks.html greycat 1212525854 forget greycat 1212525859 learn [ is NOT part of the `if' syntax. It's a normal, ordinary COMMAND. The `if' just checks its exit status. See ''help test'', http://wooledge.org/mywiki/BashGuide/Practices/BashTests and http://partmaps.org/era/unix/award-example-backticks.html \amethyst 1279999276 forget \amethyst 1279999333 learn [ is NOT part of the `if' syntax. It's a normal, ordinary COMMAND. The `if' just checks its exit stats. See `help test', http://mywiki.wooledge.org/BashGuide/TestsAndConditionals and http://partmaps.org/era/unix/award-example-backticks.html \amethyst 1279999346 forget \amethyst 1279999359 learn [ is NOT part of the `if' syntax. It's a normal, ordinary COMMAND. The `if' just checks its exit status. See `help test', http://mywiki.wooledge.org/BashGuide/TestsAndConditionals , and http://partmaps.org/era/unix/award-example-backticks.html lhunath 1393468901 forget lhunath 1393469285 learn [ or test is the POSIX test command. It can do simple tests on files and strings. In bash, you should use the more powerful [[ instead and ban [ for sake of consistency. [[ can do pattern matching, is faster and safer to use. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031 qoreQyaS 1671951369 forget qoreQyaS 1671951398 learn [ or test is the POSIX test command. It can do simple tests on files, strings and whole numbers. In bash, you should use the more powerful [[ instead and ban [ for sake of consistency. [[ can do pattern matching, is faster and safer to use. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031 qoreQyaS 1671951403 forget qoreQyaS 1671951407 learn or test is the POSIX test command. It can do simple tests on files, strings and whole numbers. In bash, you should use the more powerful [[ instead and ban [ for sake of consistency. [[ can do pattern matching, is faster and safer to use. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031 qoreQyaS 1671951484 forget qoreQyaS 1671951492 learn [ or test is the POSIX test command. It can do simple tests on files, strings and whole numbers. In bash, you should use the more powerful [[ instead and ban [ for sake of consistency. [[ can do pattern matching, is faster and safer to use. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031 larryv 1671951683 forget larryv 1671951711 learn [ or test is the POSIX test command. It can do simple pathname tests and string/integer comparisons. In bash, you should use the more powerful [[ instead and ban [ for sake of consistency. [[ can do pattern matching, is faster and safer to use. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031 larryv 1671952807 forget larryv 1671952817 learn [ or test is the POSIX test command. It can do simple pathname tests and string/integer comparisons. In bash, we recommend using [[ instead because it is faster and safer and has more features (such as pattern matching). http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031 qoreQyaS 1671984943 forget qoreQyaS 1671984944 learn [ or test is the POSIX test command. It can do simple pathname tests and string/integer comparisons. In bash, we recommend using [[ and (( instead. [[ for string and pathname related tests, it is faster, safer and has more features (i.e. pattern matching) see [1],[2]. (( or let, for integer handling, see all, esp [3]. [1] http://mywiki.wooledge.org/BashGuide/TestsAndConditionals [2] qoreQyaS 1671986056 forget qoreQyaS 1671986057 learn [ or test is the POSIX test command. It can do simple pathname tests and string/integer comparisons. In bash, we recommend using (( and [[ instead because they are faster, safer and have more features (i.e. [[ has pattern matching, (( can do math operations).see also !(( and ![[. http://mywiki.wooledge.org/BashGuide/TestsAndConditionals http://mywiki.wooledge.org/BashFAQ/031