diff --git a/nshlib/README.txt b/nshlib/README.txt index a91f94961..1bd382e82 100644 --- a/nshlib/README.txt +++ b/nshlib/README.txt @@ -268,7 +268,7 @@ file system image. Simple Commands ^^^^^^^^^^^^^^^ -o [ [!] ] +o [ ] o test These are two alternative forms of the same command. They support diff --git a/nshlib/nsh_test.c b/nshlib/nsh_test.c index 98405adde..8b4b310c8 100644 --- a/nshlib/nsh_test.c +++ b/nshlib/nsh_test.c @@ -442,28 +442,12 @@ int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) nsh_output(vtbl, g_fmtsyntax, argv[0]); return ERROR; } - else - { - bool inverted = false; - int index = 1; - int result; - /* Check if the expression is inverted */ + /* Then perform the test on the arguments enclosed by the left and right + * brackets. + */ - if (strcmp(argv[index], "!") == 0) - { - index++; - inverted = true; - } - - result = expression(vtbl, argc - index - 1, &argv[index]); - if (inverted && result != TEST_ERROR) - { - result = (result == TEST_TRUE ? TEST_FALSE : TEST_TRUE); - } - - return result; - } + return expression(vtbl, argc - 2, &argv[1]); } #endif /* !CONFIG_NSH_DISABLESCRIPT && !CONFIG_NSH_DISABLE_TEST */