diff -r 000000000000 -r 7f656887cf89 core/builtins/var.cif --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/builtins/var.cif Wed Jun 23 15:52:26 2010 +0100 @@ -0,0 +1,74 @@ +# var.cif +# +# Copyright (c) 2010 Accenture. All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Accenture - Initial contribution +# + +==name var + +==short-description + +Perform an operation involving environment variables. + +==long-description + +This command returns zero (KErrNone) in the success case, and a non-zero positive code otherwise. Usage: + + var SOMETHING defined # Doesn't cause an error, returns '1' + var SOMETHING defined && echo Defined # Nothing is echoed + export SOMETHING 1 + var SOMETHING defined && echo Defined # "Defined" will be printed + var SOMETHING == 1 && echo "Equal" # "Equal" will be printed + var SOMETHING add 3 && echo "$SOMETHING" # $SOMETHING now has value "4" + +C<==> and C are text comparisons not numerical, and all environment variables are strings, so the following will I work: + + export VAL 16 + var VAL == 0x10 && echo Equal # Error! "16" does not equal "0x10" + +==argument string variable + +The environment variable to be operated on. + +==argument enum operation + +The operation to be performed. + +==enum-value defined + +Test if the specified environment variable is defined. + +==enum-value not-defined + +Opposite of C. + +==enum-value == + +Tests if the specified environment variable is an exact string match for the supplied argument. + +==enum-value != + +Opposite of C<==>. + +==enum-value add + +Assume that the specified environment variable holds an integer, and adds the value given by the argument to it. If the variable isn't defined or doesn't contain a decimal integer, it is assumed to have value zero. + +==enum-value subtract + +Subtracts the given value from the environment variable. Semantics as per add. + +==argument string argument optional + +The argument to the operation. + +==copyright + +Copyright (c) 2006-2010 Accenture. All rights reserved. +