shell脚本练习05

Posted 荣码一生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell脚本练习05相关的知识,希望对你有一定的参考价值。

#########################################################################
# File Name: 9-6.sh
# Author: zhang yunabo
# mail: [email protected]163.com
# Created Time: Tue 18 Sep 2018 05:48:32 PM EDT
#########################################################################
#!/bin/bash
username0=
echo "username has declared,but is et to null"
echo "username0 = ${username0-`whoami`}"
echo

echo username1 has not been declared
echo "username1 = ${username1- `whoami`}"

username2=
echo "username2 has declared , but is set to null"
echo "${username2:-`whoami`}"

variable=
echo "${variable-0}"
echo "${variable:-0}"

unset variable

echo "${variable-2}"
echo "${variable:-3}"
exit 0

 

以上是关于shell脚本练习05的主要内容,如果未能解决你的问题,请参考以下文章

shell脚本小练习

shell脚本练习题

shell 脚本 片段

shell练习题

shell综合练习题(图文并茂代码清单)

shell脚本练习题