test语句实例:
#! /bin/sh
if [ -f /bin/bash ]
then
echo "file /bin/bash exits"
fi
if [ -d /bin/bash ]
then
echo "file /bin/bash is a directory"
else
echo "file /bin/bash is not a directory"
fi
本文通过一个简单的Shell脚本实例介绍了如何使用if语句来检查文件是否存在以及是否为目录,并展示了相应的输出结果。

1577

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



