mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
add aliases == and [[ for = and [ to support more bash scripts
This commit is contained in:
parent
c089ccdb44
commit
75ac42b1ae
@ -51,7 +51,7 @@
|
|||||||
unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|
|
unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|
|
||||||
"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
|
"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
|
||||||
|
|
||||||
binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
|
binary-operator ::= "="|"=="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
|
||||||
"-nt"|"-ot"|"-ef";
|
"-nt"|"-ot"|"-ef";
|
||||||
operand ::= <any legal UNIX file name>
|
operand ::= <any legal UNIX file name>
|
||||||
*/
|
*/
|
||||||
@ -135,6 +135,7 @@ static const struct t_op {
|
|||||||
"-L", FILSYM, UNOP}, {
|
"-L", FILSYM, UNOP}, {
|
||||||
"-S", FILSOCK, UNOP}, {
|
"-S", FILSOCK, UNOP}, {
|
||||||
"=", STREQ, BINOP}, {
|
"=", STREQ, BINOP}, {
|
||||||
|
"==", STREQ, BINOP}, {
|
||||||
"!=", STRNE, BINOP}, {
|
"!=", STRNE, BINOP}, {
|
||||||
"<", STRLT, BINOP}, {
|
"<", STRLT, BINOP}, {
|
||||||
">", STRGT, BINOP}, {
|
">", STRGT, BINOP}, {
|
||||||
@ -191,6 +192,11 @@ extern int test_main(int argc, char **argv)
|
|||||||
bb_error_msg_and_die("missing ]");
|
bb_error_msg_and_die("missing ]");
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
|
if (strcmp(bb_applet_name, "[[") == 0) {
|
||||||
|
if (strcmp(argv[--argc], "]]"))
|
||||||
|
bb_error_msg_and_die("missing ]]");
|
||||||
|
argv[argc] = NULL;
|
||||||
|
}
|
||||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_TEST
|
#ifdef CONFIG_TEST
|
||||||
APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
|
APPLET_NOUSAGE("[", test_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
|
||||||
|
APPLET_NOUSAGE("[[", test_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ADDGROUP
|
#ifdef CONFIG_ADDGROUP
|
||||||
APPLET(addgroup, addgroup_main, _BB_DIR_BIN, _BB_SUID_NEVER)
|
APPLET(addgroup, addgroup_main, _BB_DIR_BIN, _BB_SUID_NEVER)
|
||||||
|
Loading…
Reference in New Issue
Block a user