▲ 8 ▼ What's the actual usecase of := in parameter replacement? (lemmy.zip) submitted 1 week ago by MonkderVierte@lemmy.zip to c/shell@programming.dev 7 comments fedilink hide all child comments I've seen : "${DB_HOST:=localhost}" because it assigns the variable if not set (: $… is just to run assignments standalone). But that has the same effect like DB_HOST="${DB_HOST:-localhost} (use the string if not set), which is more readable. While something like echo "${DB_HOST:=localhost}" smells from a mile, because it has output with side-effects.
[–] MonkderVierte@lemmy.zip [S] -1 points 1 week ago (1 child) Ok, from a 90s viewpoint. permalink fedilink source parent hideshow 1 child comment replies: [–] tribut@infosec.pub 5 points 1 week ago I've seen plenty bugs that were caused by USER_NAME vs USERNAME and similar in 2026. But if thats not a concern and you think the alternatives are clearer... nobody's forcing you. permalink fedilink source parent
[–] tribut@infosec.pub 5 points 1 week ago I've seen plenty bugs that were caused by USER_NAME vs USERNAME and similar in 2026. But if thats not a concern and you think the alternatives are clearer... nobody's forcing you. permalink fedilink source parent