当我遇到以下情况时,我正在移植另一个shell脚本:
if [[ ! -x $DVDREC ]]; then
print "ERROR: $DVDREC not found. Exiting ..."
exit 1
fi
if [[ ! -c ${DVDDEV} ]]; then
print "ERROR: ${DVDDEV} not found. Exiting ..."
exit 1
fi
我想知道-c和-x选项实际上对存储的字符串做了什么 在DVDREC和DVDDEV?
答案 0 :(得分:3)
来自bash shell中的“帮助测试”:
-c FILE True if file is character special. -x FILE True if the file is executable by you.
答案 1 :(得分:3)
// man test
-c FILE
FILE exists and is character special
-x FILE
FILE exists and execute (or search) permission is granted
答案 2 :(得分:3)
引用man test
:
-c FILE FILE exists and is character special -x FILE FILE exists and execute (or search) permission is granted