linux shell中if 语句想要then后什么也不执行,关键词是什么?if [ -e ./test19 ]then \x05if [ -f ./test19 ]then/这里应填什么?/\x05else\x05\x05touch ./test19\x05fielse \x05touch ./test19fi

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/15 19:34:37
linux shell中if 语句想要then后什么也不执行,关键词是什么?if [ -e ./test19 ]then \x05if [ -f ./test19 ]then/这里应填什么?/\x05else\x05\x05touch ./test19\x05fielse \x05touch ./test19fi

linux shell中if 语句想要then后什么也不执行,关键词是什么?if [ -e ./test19 ]then \x05if [ -f ./test19 ]then/这里应填什么?/\x05else\x05\x05touch ./test19\x05fielse \x05touch ./test19fi
linux shell中if 语句想要then后什么也不执行,关键词是什么?
if [ -e ./test19 ]
then
\x05if [ -f ./test19 ]
then
/这里应填什么?/
\x05else
\x05\x05touch ./test19
\x05fi
else
\x05touch ./test19
fi

linux shell中if 语句想要then后什么也不执行,关键词是什么?if [ -e ./test19 ]then \x05if [ -f ./test19 ]then/这里应填什么?/\x05else\x05\x05touch ./test19\x05fielse \x05touch ./test19fi
你为什么要做两个判断?我看你的意思就是如果test19这个file不存在然后创建.
为什么之前还要做一个-e的判断?如果你只是判断test19,写这一句不就足够了.
if [ ! -f test19 ]
then
touch test19
fi