core/builtins/var.cif
changeset 0 7f656887cf89
child 51 3ad902ef5222
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 # var.cif
       
     2 # 
       
     3 # Copyright (c) 2010 Accenture. All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 # 
       
     9 # Initial Contributors:
       
    10 # Accenture - Initial contribution
       
    11 #
       
    12 
       
    13 ==name var
       
    14 
       
    15 ==short-description
       
    16 
       
    17 Perform an operation involving environment variables.
       
    18 
       
    19 ==long-description
       
    20 
       
    21 This command returns zero (KErrNone) in the success case, and a non-zero positive code otherwise. Usage:
       
    22 
       
    23     var SOMETHING defined # Doesn't cause an error, returns '1'
       
    24     var SOMETHING defined && echo Defined # Nothing is echoed
       
    25     export SOMETHING 1
       
    26     var SOMETHING defined && echo Defined # "Defined" will be printed
       
    27     var SOMETHING == 1 && echo "Equal" # "Equal" will be printed
       
    28     var SOMETHING add 3 && echo "$SOMETHING" # $SOMETHING now has value "4"
       
    29 
       
    30 C<==> and C<!=> are text comparisons not numerical, and all environment variables are strings, so the following will I<not> work:
       
    31 
       
    32     export VAL 16
       
    33     var VAL == 0x10 && echo Equal # Error! "16" does not equal "0x10"
       
    34 
       
    35 ==argument string variable
       
    36 
       
    37 The environment variable to be operated on.
       
    38 
       
    39 ==argument enum operation
       
    40 
       
    41 The operation to be performed.
       
    42 
       
    43 ==enum-value defined
       
    44 
       
    45 Test if the specified environment variable is defined.
       
    46 
       
    47 ==enum-value not-defined
       
    48 
       
    49 Opposite of C<defined>.
       
    50 
       
    51 ==enum-value ==
       
    52 
       
    53 Tests if the specified environment variable is an exact string match for the supplied argument.
       
    54 
       
    55 ==enum-value !=
       
    56 
       
    57 Opposite of C<==>.
       
    58 
       
    59 ==enum-value add
       
    60 
       
    61 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.
       
    62 
       
    63 ==enum-value subtract
       
    64 
       
    65 Subtracts the given value from the environment variable. Semantics as per add.
       
    66 
       
    67 ==argument string argument optional
       
    68 
       
    69 The argument to the operation.
       
    70 
       
    71 ==copyright
       
    72 
       
    73 Copyright (c) 2006-2010 Accenture. All rights reserved.
       
    74