Timeline for Bash test on successful subshell command returns false
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 8, 2015 at 9:17 | history | tweeted | twitter.com/#!/StackUnix/status/629944399762456577 | ||
| Aug 7, 2015 at 18:36 | vote | accept | Mattias | ||
| Aug 7, 2015 at 18:06 | comment | added | Mike S |
BTW, you probably want if vagrant --version > /dev/null 2>&1; then echo "HELLO"; fi
|
|
| Aug 7, 2015 at 18:05 | comment | added | Mike S |
$(vagrant --version > /dev/null) is not an expression, it is simply a subcommand. Test expressions are: File type and characteristic tests, access permission tests, string tests, or numeric tests, and connectives !, -a, and -o. Test doesn't return the status of an internal command, it returns a status depending on the evaluation of an expression.
|
|
| Aug 7, 2015 at 17:55 | comment | added | cuonglm |
$(vagrant --version > /dev/null) produce no output in case of success. test with empty string return false as defined by POSIX.
|
|
| Aug 7, 2015 at 17:43 | answer | added | ctrl-alt-delor | timeline score: 6 | |
| Aug 7, 2015 at 17:32 | history | asked | Mattias | CC BY-SA 3.0 |