Shortcuts in Science
Monday, 14 August 2017
Bash: The Difference Between := and :-
Cited from
${var:=default} vs ${var:-default} - what is difference? [duplicate]
They are similar only that ${var:=defaultvalue} assigns value to var as well and not just expand as like it.
Example:
$A='' "
$echo "${A:=2}"
2
$echo "$A"
2
$A='' "
$echo "${A:-2}"
2
$echo "$A"
(empty)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment