linux shell 学习之路---test判断是否为目录
2013-07-16 20:31
232 查看
linux shell 学习之路---test判断是否为目录
#!/bin/bashif test -d "temp"
then
echo "temp is a directory"
else
echo "temp is not a directory"
fi
说明:如果temp是目录则输出temp is a directory;否则输出temp is not a directory;
-d 对象存在且为目录返回值为“是”
-f 对象存在且为文件返回值为“是”
-L 对象存在且为符号连接返回值为“是”
-r 对象存在且可读则返回值为“是”
-s 对象存在且长度非零则返回值为“是”
-w 对象存在且可写则返回值为“是”
-x 对象存在且可执行则返回值为“是
相关文章推荐
- Linux Shell命令中判断目录下是否存在已知后缀名文件的命令
- linux shell学习笔记5( 条件判断:test,[],(),if/then )
- linux shell判断目录是否为空的函数
- Linux shell判断文件或目录是否存在
- linux shell 中判断文件、目录是否存在
- linux shell判断目录是否为空的函数
- Unix学习笔记-------目录遍历实例----Linux下判断是否是一个目录还是一个文件的方法
- shell判断当前输入的名称是否为目录(shell学习笔记三)
- Linux Shell命令中判断目录下是否存在已知后缀名文件的命令
- Linux shell脚本判断输入目录是否存在,并输出目录所在磁盘使用量
- javascript学习之路--判断浏览器是否支持javascript解释型脚本语言。
- opencv学习-imgprocess-判断点是否在轮廓内pointPolygonTest
- linux shell判断文件,目录是否存在或者具有权限
- Linux-学习-判断目录是否存在
- php is_dir 判断是否为目录
- python 新建目录,删除目录,判断目录是否存在
- VC中判断目录,文件是否存在,创建目录的方法
- php学习之道:php中is_file和file_exist的区别,and判断目录is_dir
- [C++] C++ 判断目录是否存在
- Java学习之路[目录]