#!/bin/bash

#History:

#2019/07/23    Fsq

#This Program will check Permissions on dir

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin

export PATH

read -p "please input your dir:" dir

if [ "$dir" == "" -o ! -d "$dir" ];then    #检查目录是否存在

echo "This $dir is not exsit in system"

exit 1

fi

filelist=$(ls $dir)  #列出该目录下的所有文件名

for filename in $filelist

do

perm=""

test -r "$dir/$filelist" && perm="$perm readable"

test -w "$dir/$filelist" && perm="$perm writable"

test -x "$dir/$filename" && perm="$perm executable"

echo "The file $dir/$filename's permission is $perm"

done

检查目录下 文件的权限-linux shell脚本的更多相关文章

  1. linux下为目录和文件设置权限

    摘:linux下为目录和文件设置权限 分类: Linux2012-05-09 03:18 7456人阅读 评论(1) 收藏 举报 linuxwordpressweb数据库serverfile linu ...

  2. Linux常用基础命令整理:关机命令、查看目录下文件命令等

    Linux常用基础命令整理:关机命令.查看目录下文件命令等 整理了一些Linux常用基础命令,欢迎指正. 首先记住四个热键,学会这四个键,收益一辈子. Tab按键---命令补齐功能Ctrl+c按键-- ...

  3. Linux中/proc目录下文件详解

    转载于:http://blog.chinaunix.net/uid-10449864-id-2956854.html Linux中/proc目录下文件详解(一)/proc文件系统下的多种文件提供的系统 ...

  4. Linux目录与文件的权限

    零.Linux中的权限为什么重要? 权限直接关系数据安全! 一.用户基础概念: 所有者(owner):拥有这个文件的用户.一般拥有目录或文件的所有权限. 用户组(group):几个用户组成一个用户组, ...

  5. 位于/var/log目录下的20个Linux日志文件

    位于/var/log目录下的20个Linux日志文件[译] from:http://buptguo.com/2014/01/16/linux-var-log-files/ 原文地址:20 Linux ...

  6. Linux中/proc目录下文件详解(转贴)

      转载:http://www.sudu.cn/info/index.php?op=article&id=302529   Linux中/proc目录下文件详解(一) 声明:可以自由转载本文, ...

  7. shell脚本 批量转换目录下文件编码

    发布:JB01   来源:脚本学堂     [大 中 小] 分享一例shell脚本,实现可以批量转换目录下的文件编码,很实用的一个小shell,有需要的朋友参考下.原文地址:http://www.jb ...

  8. linux 目录下文件批量植入和删除,按日期打包

    linux目录下文件批量植入 [root@greymouster http2]# find /usr/local/http2/htdocs/ -type f|xargs sed -i "   ...

  9. shell脚本监控目录下文件被篡改时报警

    思路: 目录下文件被篡改的几种可能: 1.被修改 2.被删除 3.新增文件 md5命令详解 参数: -b 以二进制模式读入文件内容 -t 以文本模式读入文件内容 -c 根据已生成的md5值,对现存文件 ...

随机推荐

  1. 配置进程外Session 同时解决一个奇怪的BUG 因为SQLserver 服务器名不是默认的.或者localhost而引发的一系列问题

    用公司的电脑学习如鹏网的视频,开发一个项目,用到了进程外session,因为公司电脑SQLServer 是2008 服务器名称是.  然后参考这篇文章进行设置进程外session 很顺利 完成了设置. ...

  2. 初识PHP变量函数语法

    PHP连接字符串 . <?php '你好,'.'我的亲爱的老师'?> PHP语句结束符 <?php echo "欢迎同学们!"; echo "Welco ...

  3. 2018-8-10-win10-UWP-用Path画图

    title author date CreateTime categories win10 UWP 用Path画图 lindexi 2018-08-10 19:16:50 +0800 2018-2-1 ...

  4. 【leetcode】994. Rotting Oranges

    题目如下: In a given grid, each cell can have one of three values: the value 0 representing an empty cel ...

  5. Mybatis基于接口注解配置SQL映射器(二)

    Mybatis之增强型注解 MyBatis提供了简单的Java注解,使得我们可以不配置XML格式的Mapper文件,也能方便的编写简单的数据库操作代码.但是注解对动态SQL的支持一直差强人意,即使My ...

  6. Yii2邮件发送

    1.在配置文件main-local.php components=>[]里面配置 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', ...

  7. redis requires Ruby version >= 2.2.2.

    安装RVM 无法在服务器使用curl命令访问https域名,原因是nss版本有点旧了,yum -y update nss更新一下 yum -y update nss 新建rvm-installer.s ...

  8. location优先级

    location优先级 location优先级 location /img # 直接匹配 location /img { index index.html } location = /img # 精确 ...

  9. ASP.NET MVC 分页之 局部视图

    using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptograph ...

  10. linux c(一)Helloworld

    终端的屏幕上输入命令如下: 使用vi helloworld.c打开helloworld.c文件,写下如下代码: