Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I would recommend to do something like this. serverfault.com/a/24063 Commented Jun 23, 2014 at 15:00
  • @Ramesh So, would the resulting code end up looking something like ${GREEN:-}? Commented Jun 23, 2014 at 15:07
  • I have not tried that option. But, as per the suggestion in that answer, if your variable is empty, it will get set to something like empty and if it is not empty, it will get set to something else. Commented Jun 23, 2014 at 15:09
  • @Ramesh That will not help in this situation because the whole point of this question is that he is trying to avoid writing the assignment statement twice for the same variable. If he didn't care about that he could simple add GREEN="" DIM="" RESET="" before the if statement. Commented Jun 23, 2014 at 17:20
  • I hope you do not export the var's and call another script with GREEN defined different ("#FF0000"). Commented Jun 29, 2014 at 21:41