shell脚本练习05

#########################################################################
# File Name: 9-6.sh
# Author: zhang yunabo
# mail: ma6174@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

 

posted @ 2018-09-18 23:30  荣码一生  阅读(124)  评论(0编辑  收藏  举报