ash: expr -e support
This commit is contained in:
parent
482afb8a6f
commit
0964b221e7
3 changed files with 6 additions and 0 deletions
|
@ -279,6 +279,9 @@ expr_operator(op, sp, fs)
|
||||||
sp->u.num = expr_is_false(sp);
|
sp->u.num = expr_is_false(sp);
|
||||||
sp->type = BOOLEAN;
|
sp->type = BOOLEAN;
|
||||||
break;
|
break;
|
||||||
|
case EXISTS:
|
||||||
|
if (fs->rcode >= 0) goto true;
|
||||||
|
goto false;
|
||||||
case ISREAD:
|
case ISREAD:
|
||||||
i = 04;
|
i = 04;
|
||||||
goto permission;
|
goto permission;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
# by the Ash General Public License. See the file named LICENSE.
|
# by the Ash General Public License. See the file named LICENSE.
|
||||||
|
|
||||||
NOT ! 3
|
NOT ! 3
|
||||||
|
EXISTS -e 12 OP_FILE
|
||||||
ISREAD -r 12 OP_FILE
|
ISREAD -r 12 OP_FILE
|
||||||
ISWRITE -w 12 OP_FILE
|
ISWRITE -w 12 OP_FILE
|
||||||
ISEXEC -x 12 OP_FILE
|
ISEXEC -x 12 OP_FILE
|
||||||
|
|
|
@ -153,6 +153,8 @@ The remaining operators all deal with files. Except as noted, they return
|
||||||
false if the
|
false if the
|
||||||
specified file does not exist. The ones dealing with permission use
|
specified file does not exist. The ones dealing with permission use
|
||||||
the effective user and group ids of the shell.
|
the effective user and group ids of the shell.
|
||||||
|
.u \-e string boolean
|
||||||
|
True the file exists.
|
||||||
.u \-r string boolean
|
.u \-r string boolean
|
||||||
True if you have read permission on the file.
|
True if you have read permission on the file.
|
||||||
.u \-w string boolean
|
.u \-w string boolean
|
||||||
|
|
Loading…
Reference in a new issue