检查 ksh 中是否存在文件
我想知道为什么下面的小脚本现在可以工作。 我在 /data 目录下创建了 dfFile,但脚本不打印 if 语句中的表达式。
#!/bin/ksh
DATAFILE="/data/dfFile"
echo $DATAFILE
#df -h>/data/dfFile
if [[ -e DATAFILE ]]
then
echo "sa"
echo $DATAFILE
df -h > $DATAFILE
fi
I wonder why the below tiny script is now working.
I created dfFile under /data directory but script does not print the expressions in if statement.
#!/bin/ksh
DATAFILE="/data/dfFile"
echo $DATAFILE
#df -h>/data/dfFile
if [[ -e DATAFILE ]]
then
echo "sa"
echo $DATAFILE
df -h > $DATAFILE
fi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

那应该读
That should read