In order of decreasing precedence:
Operator
|
Meaning
|
|
---|---|---|
( ) | Grouping or Procedure call arguments | |
{ } | Run the enclosed statement list and return 1 if it succeeds or 0 otherwise. | |
[ ] | Array indexing. (The first element is element 0.) | |
-A
-C
-D
-H
-R
-S
-d
-e
-f
-o
-w
-x
-z |
File system tests | |
++ -- | Prefix and postfix increment/decrement | |
~ - ! + | Bitwise, arithmetic and logical complements and unary plus | |
** | Exponentiation | |
* / % // | Multiplication, Division, Remainder and Integer Division | |
+ - | Addition and Subtraction | |
<< >> | Bit-Shifting | |
== != =~ !~ < <= >= > | Relation-testing and pattern-matching operators | |
& | Bit And | |
^ | Bit Xor | |
| | Bit Or | |
&& | Logical And | |
|| | Logical Or | |
?: | Conditional selection | |
=
+=
-=
*=
/=
%=
//=
>>=
<<=
&=
^=
|=
**= |
Assignment operators |
Expressions result in sensible types, considering both the types and the values of the operands. For example, 10/2 returns the integer 5 but 5/2 produces the floating point value 2.5. Also, the integer 1, the floating point value 1.0 and the string "1" all compare equal.
The operand of a file system test is interpreted as a word, not an expression, and may involve wildcarding. If wildcarding produces more than one match, the test is done on the first one.
Prefix Operator
|
True if
|
|
---|---|---|
-A | Archive Bit Set | |
-C | File or Directory is Compressed | |
-D -d | Directory | |
-H | Hidden File or Directory | |
-R | Read-only File or Directory | |
-S | System File or Directory | |
-e | File or Directory Exists | |
-f | Ordinary File | |
-o | Ownership (Same as Existence on an OS/2 or NT FAT file system) | |
-r | Readable (Same as ordinary file on an OS/2 or NT FAT file system) | |
-w | Writable (Not Read-only and not a directory) | |
-x | Executable (Has a .csh, .exe, .com or .cmd extension and, if it's an .exe or a .com file, appears to be a valid OS/2 or NT binary executable.) | |
-z | Zero-length File |
Example:
if (-d $a) then
 echo $a is a directory
end
Previous Topic |
Next Topic
Hamilton C shell |
Free Updates |
Free Demo Software |
Win32 Training
Y2K |
Customer Testimonials |
On-line Hamilton C shell User Guide
Home |
Email |
Support |
Company Profile |
Distributors |
Links
Copyright © 1997-2001 by Hamilton Laboratories. All rights reserved.
You are visitor number
1793.
This page was last modified August 9, 2001.