From: David van Moolenbroek Date: Wed, 16 Jun 2010 09:33:11 +0000 (+0000) Subject: ash: expr -e support X-Git-Tag: v3.1.8~448 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/style.css?a=commitdiff_plain;h=0964b221e70e45eee7a0d67594673ad96bbf29ff;p=minix.git ash: expr -e support --- diff --git a/commands/ash/bltin/expr.c b/commands/ash/bltin/expr.c index 07052186c..63e2844f7 100644 --- a/commands/ash/bltin/expr.c +++ b/commands/ash/bltin/expr.c @@ -279,6 +279,9 @@ expr_operator(op, sp, fs) sp->u.num = expr_is_false(sp); sp->type = BOOLEAN; break; + case EXISTS: + if (fs->rcode >= 0) goto true; + goto false; case ISREAD: i = 04; goto permission; diff --git a/commands/ash/bltin/unary_op b/commands/ash/bltin/unary_op index 26748aa62..e7a0f3cb6 100755 --- a/commands/ash/bltin/unary_op +++ b/commands/ash/bltin/unary_op @@ -5,6 +5,7 @@ # by the Ash General Public License. See the file named LICENSE. NOT ! 3 +EXISTS -e 12 OP_FILE ISREAD -r 12 OP_FILE ISWRITE -w 12 OP_FILE ISEXEC -x 12 OP_FILE diff --git a/man/man1/expr.1 b/man/man1/expr.1 index 18a46085b..9e04e73f3 100644 --- a/man/man1/expr.1 +++ b/man/man1/expr.1 @@ -153,6 +153,8 @@ The remaining operators all deal with files. Except as noted, they return false if the specified file does not exist. The ones dealing with permission use the effective user and group ids of the shell. +.u \-e string boolean +True the file exists. .u \-r string boolean True if you have read permission on the file. .u \-w string boolean