“variable” Réponses codées

variable

foo="Hello"
foo="${foo} World"
echo "${foo}"
> Hello World
C0W

variable

Context                               | Expression            | Result (value of c)
--------------------------------------+-----------------------+---------------------
Two variables                         | c=$a$b                | helloworld
A variable and a literal              | c=${a}_world          | hello_world
A variable and a literal              | c=$1world             | oneworld
A variable and a literal              | c=$a/world            | hello/world
A variable, a literal, with a space   | c=${a}" world"        | hello world
A more complex expression             | c="${a}_one|${b}_2"   | hello_one|world_2
Using += operator (Bash 3.1 or later) | c=$a; c+=$b           | helloworld
Append literal with +=                | c=$a; c+=" world"     | hello world
Fine Fowl

Réponses similaires à “variable”

Questions similaires à “variable”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code