From: Enver ALTIN (ealtin@parkyeri.com)
Date: Tue 31 Aug 2004 - 19:24:33 EEST
On Tue, 2004-08-31 at 19:24 +0300, Recai Oktas wrote:
> * Enver ALTIN [2004-08-31 18:52:39+0300]
> > > Madem 'bash' bagimli kullaniyorsunuz 'var0=$(($var0 + 1))' de olabi
lir.
> > $var0++
>
> Keske 'bash'de calissa... Bu 'csh' olmali, fazla asinasi degilim.
> Uyarin uzerine denedigimde soyle birsey calisiyor:
>
> % @ var=3
> % @ var++
> % echo $var
> 4
>
> Ben yine de bash'den sasmayayim, gozum daha aliskin :-)
#!/bin/bash
i=0
let i++
echo $i
skyblue@roadrunner:~$ help let
let: let arg [arg ...]
Each ARG is an arithmetic expression to be evaluated. Evaluation
is done in fixed-width integers with no check for overflow, though
division by 0 is trapped and flagged as an error. The following
list of operators is grouped into levels of equal-precedence
operators.
The levels are listed in order of decreasing precedence.
id++, id-- variable post-increment, post-decrement
++id, --id variable pre-increment, pre-decrement
-, + unary minus, plus
!, ~ logical and bitwise negation
** exponentiation
*, /, % multiplication, division, remainder
+, - addition, subtraction
<<, >> left and right bitwise shifts
<=, >=, <, > comparison
==, != equality, inequality
& bitwise AND
^ bitwise XOR
| bitwise OR
&& logical AND
|| logical OR
expr ? expr : expr
conditional operator
=, *=, /=, %=,
+=, -=, <<=, >>=,
&=, ^=, |= assignment
Shell variables are allowed as operands. The name of the variable
is replaced by its value (coerced to a fixed-width integer) within
an expression. The variable need not have its integer attribute
turned on to be used in an expression.
Operators are evaluated in order of precedence. Sub-expressions in
parentheses are evaluated first and may override the precedence
rules above.
If the last ARG evaluates to 0, let returns 1; 0 is returned
otherwise.
-- Enver ALTIN | http://skyblue.gen.tr/ Software developer @ Parkyeri | http://www.parkyeri.com/-- Attached file included as plaintext by Ecartis -- -- File: signature.asc -- Desc: This is a digitally signed message part
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQBBNKZBZCB2FZvqK0sRAnjSAKCBb/AQ26I77xc2RshgdcNUtoQkAwCePygh +aAj770DHnaMSpc5oMqiXdI =e0wl -----END PGP SIGNATURE-----
--- linux-baslangic listesinden cikmak ve tum listeci islemleri icin http://liste.linux.org.tr/ adresini kullanabilirisniz. Bu listeden cikmak icin <a href="mailto:linux-baslangic-request@liste.linux.org.tr?Subject=unsubscribe"> tiklayiniz</a>