PHP计算德摩根定律,德·摩根定律详解

一. 德·摩根定律

非(A且B) = (非A) 或(非B)

非(A 或B) = (非A) 且(非B)

1.德·摩根定律确实让人头疼,下面为大家具体详解

38c0a2b097d1965a98e6764779cda579.png

由图片可知

A=1+2 ;B=2+3 ;c=4

非A=3+4

非B=1+4

A且B 是同时是A,也同时是B,所以A且B=2

A或B 既可以是A,也可以是B,所以A或B=1+2+3

所以非(A且B) =1+3+4  (非A) 或(非B) =3+4+1

得    非(A且B) = (非A)或(非B)

同理可知 非(A或B) = (非A)且(非B)

(2)在linux中组合条件为

与:-a

或:-o

非:-not, !

德·摩根定律即:

!A -a !B = !(A -o B)

!A -o !B = !(A -a B)

实例:

查找/var目录下最近一周内其内容修改过,同时属主不为root,也不是postfix的文件[root@centos7 bin]# find /var -mtime -7 -not \( -user root -o -user postfix \)

或者

[root@centos7 bin]# find /var -mtime -7 -not -user root -a -not -user postfix

二. 作业:

1、查找/var目录下属主为root,且属组为mail的所有文件[root@centos7 bin]# find /var -user root -group mail

2、查找/var目录下不属于root、lp、gdm的所有文件[root@centos7 bin]# find /var -not \( -user root -o -user lp -o -user gdm \) -ls

3、查找/var目录下最近一周内其内容修改过,同时属主不为root,也不是postfix的文件[root@centos7 bin]# find /var -mtime -7 -not \( -user root -o -user postfix \)

4、查找当前系统上没有属主或属组,且最近一个周内曾被访问过的文件[root@centos7 bin]# find / -nouser -nogroup -atime -7 -ls

5、查找/etc目录下大于1M且类型为普通文件的所有文件[root@centos7 bin]# find /etc -size +1M -type f -ls

6、查找/etc目录下所有用户都没有写权限的文件[root@centos7 bin]# find /etc/  -not    -perm  /222 -ls

7、查找/etc目录下至少有一类用户没有执行权限的文件[root@centos7 bin]# find /etc/ -not  -perm -111 -ls

8、查找/etc/init.d目录下,所有用户都有执行权限,且其它用户有写权限的文件[root@centos7 bin]# find /etc/init.d/  -perm -113

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值