shell脚本基础

shell
在shell脚本中,如果用户不输入东西,系统不自动退出,this is a bug!
文件测试语句:-d -f -r -w -x -e
逻辑测试语句:“&&”与(同时满足) “||”或(前为假,后面才实施) “!”非(看中间是与还是或来决定)
整数值比较语句:eq(是否等于) gt(是否大于) lt(是否小于) ge(是否大于或等于) le(是否小于或等于) ne(是否不等于)
字符串比较语句:=(等于) !=(不等于) -z(是否为空)

if条件测试语句
if条件语句的单分支结构有if\then\fi 关键词组成,相当于口语的“如果...那么...”
#vi if.sh
#!/bin/bash
yt="/1/2/3/4"
if[ ! -e $yt] if [ -w $yt]
then
mkdir -p $yt chmod g+w $yt
fi #bash
#ll if.sh #ll -d /1/2/3/4
#bash if.sh
shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础

shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础

shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础
shell脚本基础

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章