gpt4 book ai didi

Linux shell : Verify whether a file exists and is a soft link?

转载 作者:太空宇宙 更新时间:2023-11-04 09:44:27 25 4
gpt4 key购买 nike

在Linux上如何验证一个文件或目录是否存在并且是符号链接(symbolic link)(软链接(soft link))?

我想写一个shell来做。

你能给我一些建议吗?

最佳答案

您可以使用-L 测试选项:

if [[ -L $file ]]; then
echo "$file exists and is a symbolic link"
fi

关于Linux shell : Verify whether a file exists and is a soft link?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17918367/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com