#!/bin/bash
if [ -s EmptyFile ]
then
echo "file has content"
else
echo "file is empty"
fi
if [ -s EmptyFile ]
then
echo "file has content"
else
echo "file is empty"
fi
本文介绍了一个简单的Shell脚本,用于检查指定文件是否为空。通过使用if语句和test命令,脚本能够判断文件是否有内容并返回相应的消息。这种脚本对于自动化文件检查任务非常有用。

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