test命令-linux shell 脚本
2024-10-07 15:24:48
#!/bin/bash
# This is program will check you file name,which sys has or not,end print types.
#2019/07/19 FSQ
First release
echo -e "input file name:" filename
read filename
test -z $filename && echo "please input a file name" && exit 0 #test -z 检查输入是否为空
test ! -e $filename && echo" $filename is not exsit" && exit 0 # test -e 检查输入的文件是否存在
test -d $filename && filetype="regulare file" #检查文件的是否是目录
test -f $filename && filetype="directory" #检查文件是否常规文件
test -r $filename && perm="readable" #检查文件的执行状态 是否可读
test -w $filename && perm="$perm writeable" #检查文件的执行状态 是否可写
test -x $filename && perm="$perm execute#检查文件是否 可执行
echo "The file name : $filename is a $filetype" #输出文件的类型
echo "And the permissions are :$perm" #输出文件的权限
最新文章
- Python单元测试和Mock测试
- Python socket超时
- 模块(modue)的概念:
- 组合数问题hdu5894
- java代码调用oracle存储过程
- linux学习建议
- css 串联选择器和后代选择器
- Eclipse配置安卓开发环境(解决SDK manager下载慢问题)
- Django设置TIME_ZONE和LANGUAGE_CODE为中国区域
- SVN global ignore pattern for c#
- 常用ARM指令集及汇编_破解
- 数据提交成功后如何避免alert被window.location.reload()影响
- BZOJ_2631_tree_LCT
- python--数据类型bytes
- MySql常用命令集Mysql常用命令5
- 【Mysql优化三章】第一章
- Codeforces 894B - Ralph And His Magic Field
- JavaScript学习(二)——深入学习js对象的原型与继承
- MD5加密--项目案例
- mysql中间件 ->; Atlas简介&;安装