|
|
|||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
|
|
|
|
|||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
|
|
|
|
|||||||||||||||||||||||||||||||||
|
10.6 AssignmentsWhen setting several variables in a row, be aware that the order of the evaluation is undefined. For instance `foo=1 foo=2; echo $foo' gives `1' with sh on Solaris, but `2' with Bash. You must use `;' to enforce the order: `foo=1; foo=2; echo $foo'. Don't rely on the exit status of an assignment: Ash 0.2 does not change the status and propagates that of the last statement:
and to make things even worse, QNX 4.25 just sets the exit status to 0 in any case:
To assign default values, follow this algorithm:
In most cases `var=${var="$default"}' is fine, but in case of doubt, just use the latter. See section 10.5 Shell Substitutions, items `${var:-value}' and `${var=value}' for the rationale.
|
|
|||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
|
Marketplace: | |||||||||||||||||||||||||||||||||||
| " All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. " | |||||||||||||||||||||||||||||||||||