1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| ${parameter:-word}
Substitutes the value of parameter if it is set and non-null; other-
wise, substitute word.
${parameter:=word}
Sets parameter to word if it is not set or is null; the value of the
parameter is then substituted. Positional parameters cannot be
assigned values in this way.
${parameter:?[word]}
Substitutes the value of parameter if it is set and is non-null; other-
wise, print word and exit from the shell. If word is omitted, a stan-
dard message is printed.
${parameter:+word}
Substitute word if parameteris set and is non-null; otherwise, substi-
tute nothing.
${parameter#pattern} | ${parameter##pattern}
Causes the value of this substitution to be the value of parameter with
the matched portion deleted if the shell pattern matches the beginning
of the value of parameter; otherwise the value of parameter is substi-
tuted. In the first form, the smallest matching pattern is deleted and
in the second form, the largest matching pattern is deleted.
${parameter%pattern} | ${parameter%%pattern}
Causes the value of this substitution to be the value of parameter with
the matched part deleted if the shell pattern matches the end of the
value of parameter; otherwise, substitute the value of parameter. In
the first form, the smallest matching pattern is deleted and in the
second form, the largest matching pattern is deleted. |
Partager