GRUB's test scripts often show this gesture
: "${TMPDIR=/tmp}"
Well known and described is
${X:=Y}
which assigns a default value to variable X if it is empty (man bash
says: "If [...] unset or null").
Also known and described is ":", the no-op command.
So
: "${TMPDIR:=/tmp}"
would not be a riddle. But "=" instead ":=" causes a subtle change in behavior. A defined but empty variable does not get the default content:
Everyone skips over the sentence that begins with "Omitting the colon".
Every time we try to tell Chet, "Hey, man, please add examples that
show BOTH syntaxes" [...]
maybe i am just too dumb to read the manual, or maybe i made an archeological discovery in the shells we use.
Everyone skips over the sentence that begins with "Omitting the colon".
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 166:50:25 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,529 |