码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本练习05

时间:2018-09-18 23:54:06      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:style   练习   pre   zhang   exit   declared   variable   shell脚本   class   

#########################################################################
# 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

 

shell脚本练习05

标签:style   练习   pre   zhang   exit   declared   variable   shell脚本   class   

原文地址:https://www.cnblogs.com/zhangyuanbo12358/p/9672118.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!