script执行方式区别
bash 文件:script程序在新的bash环境运行,即子程序中运行
source 文件:script程序在父程序中运行
test命令
test –e 文件名 :该文件名是否存在
test –f 文件名 :该文件名是否存为且为文件(file)
例. test -e list && echo "exist" || echo "no exist"
test多重条件判定
-a 两个条件同时成立
-o 任何一个条件成立
! 反向状态
例. test –r file –a –x file,则文件file同时具有r与x权限时,返回true
test !-x file,当file不具有x时,返回true