#!/bin/bash
cd ./bin
if test -e ./bash
then
echo "file exist"
else
echo "file not exist"
fi
if test -e ./bash -o -e ./notfile
then
echo "at least one file exist"
else
echo "file both not exist"
fi
输出结果:
file exist
at least one file exist
这篇文章介绍了两个Bash脚本示例,分别检测'./bash'和'./notfile'的文件存在情况。脚本输出结果显示了'fileexist'和'atleastonefileexist'。关键词围绕文件系统操作、shell编程和条件判断展开。

6087

被折叠的 条评论
为什么被折叠?



