Is there a way in Bash and Zsh that says, if the variable is an empty string, make it 0?

前端 未结 0 834
青春惊慌失措
青春惊慌失措 2020-12-08 19:56

I understand the empty string in Bash is falsy, and we should be able to use something like

a=""
b=($a || 0)

which means if $

相关标签:
回答
  • 消灭零回复
提交回复
热议问题