Avaya Writing Technician Interface Scripts Manuel d'utilisateur Page 17

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 116
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 16
Creating a Script File
117382-A Rev. A 1-3
To prevent a variable from being expanded, enter two dollar signs ($$) before the
variable name, as shown in the following example:
setenv a blue
setenv b “My color is \$a”
echo $$b
My color is $a
appears on the user’s console.
You may embed variables in quoted strings, as shown in the previous example.
The following command line encloses the variable names
a and b in braces ({ }) to
separate the variable names from other data within the string.
echo “The sum of ${a}+1=${b}”
A variable name is usually a literal string of characters preceded by a dollar sign
($). The variable name can also be “built” dynamically when the script is executed
by using a combination of literal text and the text stored in other variables.
For example, if you have a variable named array_10, you can reference this
variable by entering
$array_10 on a command line. You can build this same
variable name by concatenating the text strings
array_ and 10. For example, if
you assign the variable index the value 10, using the command
let index = 10,
then you can build the variable name array_10 dynamically on the command line
using the following syntax:
${array_[$index]}. Notice the use of the brackets ([ ])
within the variable name. Any literal text or variable name specified within the
brackets is first expanded to replace any variables with their values and then
concatenated onto the preceding characters of the variable name. To use brackets,
you must enclose the entire variable name being built within braces (
{ }).
Note: If the variable name is followed by a space or an end-of-line character
(carriage return), the brackets are optional.
Vue de la page 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 115 116

Commentaires sur ces manuels

Pas de commentaire