Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
在 shell 中,[ -L "$f" ] && [ -e "$f" ] 当且仅当“$f”是目标存在的符号链接的名称时才为 true。所以:(
[ -L "$f" ] && [ -e "$f" ]
for f in *; do if [ -L "$f" ] && [ -e "$f" ]; then # do something with "$f" fi done
切勿使用 -a 或 -o 选项来 test/[...]; 不能相信它们具有合理的优先级。)
-a
-o
test
[
]
In shell, [ -L "$f" ] && [ -e "$f" ] is true if and only if "$f" is the name of a symlink whose target exists. So:
(Never use the -a or -o options to test/[...]; they cannot be relied on to have sane precedence.)
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
在 shell 中,
[ -L "$f" ] && [ -e "$f" ]
当且仅当“$f”是目标存在的符号链接的名称时才为 true。所以:(切勿使用
-a
或-o
选项来test
/[
...]
; 不能相信它们具有合理的优先级。)In shell,
[ -L "$f" ] && [ -e "$f" ]
is true if and only if "$f" is the name of a symlink whose target exists. So:(Never use the
-a
or-o
options totest
/[
...]
; they cannot be relied on to have sane precedence.)