我无法检查功能测试的返回值; 男子测试对我没什么帮助.
#!/bin/bash
test=$(test -d $1)
if [ $test -eq 1 ]
then
echo "the file exists and is a directory"
elif [ $test -eq 0 ]
echo "file does not exist or is not a directory"
else
echo "error"
fi
Run Code Online (Sandbox Code Playgroud)
试试吧
if test -d $1
then
echo 'the file exists and is a directory'
else
echo 'the file doesn't exist or is not a directory'
fi
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
309 次 |
| 最近记录: |