Hacker News new | ask | show | jobs
by prairiedock 3501 days ago
It's not advanced, it's not long enough, and it's not correct either.

> This will set the value of TMP to `/tmp/myproject` only if it has not been set.

This should read "if", not "only if". And it should read: "This will set the value of TMP to `/tmp/myproject` if it has not been set or if it is null."

The form that means 'if it has not been set' has no colon; it is

  TMP=${TMP-/tmp/myproject}
  
See https://www.gnu.org/software/bash/manual/bash.html#Shell-Par...