我试图创建一个脚本,通过搜索目录来查找指向不存在的对象的符号链接。符号链接检查 - Linux Bash脚本
我有一个文件在一个删除符号链接的目录,但由于某种原因,当我运行下面的脚本它说文件存在。
#!/bin/bash
ls -l $1 |
if [ -d $1 ]
then
while read file
do
if test -e $1
then
echo "file exists"
else
echo "file does not exist"
fi
done
else
echo "No directory given"
fi
感谢