test -e echo ; echo $?提供的输出为1(False),而不是0 (True)。
如果文件存在,则test -e FILE返回True 0,否则返回False 1。
那么为什么test -e echo返回1
发布于 2021-07-21 05:16:37
因为文件echo在当前目录中不存在。
尝试创建它:
touch echo
test -e echo && echo Exists.如果要检查/bin/echo,则需要将目录更改为/bin,或者指定完整路径。
cd /bin
test -e echo或
test -e /bin/echohttps://stackoverflow.com/questions/68461417
复制相似问题