Y
Hacker News
new
|
ask
|
show
|
jobs
by
cellularmitosis
3374 days ago
I start out like that, but often I end up having to remove -u if I'm e.g. trying to check if $1 is populated. Is there a way to do that while still using -u?
1 comments
mdaniel
3374 days ago
Same as any potentially unbound variable, by providing a (possibly empty) default value:
if [ "${1:-}" == "my awesome value" ]; then ...
link