⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 param-sub.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# param-sub.sh#  Whether a variable has been declared#+ affects triggering of the default option#+ even if the variable is null.username0=echo "username0 has been declared, but is set to null."echo "username0 = ${username0-`whoami`}"# Will not echo.echoecho username1 has not been declared.echo "username1 = ${username1-`whoami`}"# Will echo.username2=echo "username2 has been declared, but is set to null."echo "username2 = ${username2:-`whoami`}"#                            ^# Will echo because of :- rather than just - in condition test.# Compare to first instance, above.## Once again:variable=# variable has been declared, but is set to null.echo "${variable-0}"    # (no output)echo "${variable:-1}"   # 1#               ^unset variableecho "${variable-2}"    # 2echo "${variable:-3}"   # 3exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -