[lidapeng@X61s ~]$ unset a [lidapeng@X61s ~]$ echo ${a:-abc} abc [lidapeng@X61s ~]$ a=ABC [lidapeng@X61s ~]$ echo ${a:-abc} ABC
[lidapeng@X61s ~]$ unset a [lidapeng@X61s ~]$ echo $a [lidapeng@X61s ~]$ echo ${a:=abcd} abcd [lidapeng@X61s ~]$ echo $a abcd
[lidapeng@X61s ~]$ unset a [lidapeng@X61s ~]$ echo ${a:?abcd} bash: a: abcd [lidapeng@X61s ~]$ echo ${a:?}此行未设置标准错误输出,故收到bash错误提示。 bash: a:参数为空或未设置 [lidapeng@X61s ~]$ echo $a [lidapeng@X61s ~]$ a=123 [lidapeng@X61s ~]$ echo ${a:?abcd} 123
[lidapeng@X61s ~]$ unset a [lidapeng@X61s ~]$ echo ${a:+abcd} [lidapeng@X61s ~]$ a=123 [lidapeng@X61s ~]$ echo ${a:+abcd} abcd [lidapeng@X61s ~]$ echo $a 123
find ${dir_path:=/data/mysql_back_data/} -name '*.tar.gz' -type f -mtime +7 | xargs rm -f
[lidapeng@X61s /root]$ (cd ~;ls;pwd; ) 1.sh del_data.sh nohup.out test.txt 2.sh Downloads sub_str /home/lidapeng [lidapeng@X61s /root]$
[lidapeng@X61s /root]$ (cd ~;ls;pwd; echo $BASH_SUBSHELL) 1.sh del_data.sh nohup.out test.txt 2.sh Downloads sub_str /home/lidapeng 1 [lidapeng@X61s /root]$ (cd ~;ls;pwd; (echo $BASH_SUBSHELL)) 1.sh del_data.sh nohup.out test.txt 2.sh Downloads sub_str /home/lidapeng 2
[lidapeng@X61s /root]$ type cd cd 是 shell 内建 [lidapeng@X61s /root]$ type exit exit 是 shell 内建 [lidapeng@X61s /root]$ type ps ps 已被录入哈希表 (/bin/ps) [lidapeng@X61s /root]$ type ls ls 已被录入哈希表 (/bin/ls) [lidapeng@X61s /root]$ type pwd pwd 是 shell 内建 [lidapeng@X61s /root]$ type find find 已被录入哈希表 (/usr/bin/find)