#!/bin/bash
#set -x
host=`hostname`
ip=`ifconfig $(ip a|grep eth|head -n1|awk -F: '{print $2}') |grep 'inet addr:'|awk -F: '{print $2}'|awk '{print $1}'`
function pan(){
for i in $@
do
if [ $i == 'cditv' ];then
echo 0 && exit
fi
done
}
> /tmp/tttt.txt
> /tmp/temp
> /tmp/temp0
> /tmp/temp1
y=`cat /etc/passwd|grep '/bin/bash'|grep -vE 'zabbix|root|nginx|fpm|sperm'|awk -F: '{print $1}'` x=`pan $y` if [ -z $x ];then
echo -ne $host-$ip >> /tmp/temp
for i in $y
do
k=`groups $i|awk '{print $4}'`
if [ -z $k ];then
echo $i >> /tmp/temp1
elif [ $k != 'cditv' ];then
echo $i >> /tmp/temp1
elif [ $k == 'cditv' ];then
echo $i >> /tmp/temp0
fi
done elif [ $x == 0 ];then
echo -ne $host-$ip >> /tmp/temp
for i in $y
do
k=`groups $i|awk '{print $4}'`
if [ $i == 'cditv' ];then
echo $i >> /tmp/temp0
else
if [ -z $k ];then
echo $i >> /tmp/temp1
elif [ $k != 'cditv' ];then
echo $i >> /tmp/temp1
elif [ $k == 'cditv' ];then
echo $i >> /tmp/temp0
fi
fi
done fi
paste /tmp/temp /tmp/temp0 /tmp/temp1 > /tmp/tttt.txt #合成3列
rm -rf /tmp/temp /tmp/temp0 /tmp/temp1
cat /tmp/tttt.txt
echo -ne "\n"

  

linux shell系列9 统计用户的权限的更多相关文章

  1. Linux Shell系列教程之(十六) Shell输入输出重定向

    本文是Linux Shell系列教程的第(十六)篇,更多Linux Shell教程请看:Linux Shell系列教程 Shell中的输出和输入的重定向是在使用中经常用到的一个功能,非常实用,今天就为 ...

  2. Linux Shell系列教程之(十四) Shell Select教程

    本文是Linux Shell系列教程的第(十四)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上一篇文章:Linux Shell系列教程之(十三)Shell分支语句case ...

  3. (转)Linux Shell系列教程之(十四) Shell Select教程

    本文属于<Linux Shell 系列教程>文章系列,该系列共包括以下 18 部分: Linux Shell系列教程之(一)Shell简介 Linux Shell系列教程之(二)第一个Sh ...

  4. Linux Shell系列教程之(二)第一个Shell脚本

    本文是Linux Shell系列教程的第(二)篇,更多shell教程请看:Linux Shell系列教程 通过上一篇教程的学习,相信大家已经能够对shell建立起一个大体的印象了,接下来,我们通过一个 ...

  5. Linux Shell系列教程之(一)Shell简介

    本文是Linux Shell系列教程的第(一)篇,更多shell教程请看:Linux Shell系列教程 想要学习linux,shell知识必不可少,今天就给大家来简单介绍下shell的基本知识. S ...

  6. Linux Shell系列教程之(十七) Shell文件包含

    本文是Linux Shell系列教程的第(十七)篇,更多Linux Shell教程请看:Linux Shell系列教程 通过文件包含,可以引用其他文件的内容,也可以将复杂内容分开,使程序结构更加清晰. ...

  7. Linux Shell系列教程之(十五) Shell函数简介

    本文是Linux Shell系列教程的第(十五)篇,更多Linux Shell教程请看:Linux Shell系列教程 函数可以将一个复杂功能划分成若干模块,从而使程序结构更加清晰,代码重复利用率更高 ...

  8. Linux Shell系列教程之(十三)Shell分支语句case … esac教程

    本文是Linux Shell系列教程的第(十三)篇,更多Linux Shell教程请看:Linux Shell系列教程 分支语句非常实用,基本上高级语言都支持分支语句(python 没有),大多数都使 ...

  9. Linux Shell系列教程之(十二)Shell until循环

    本文是Linux Shell系列教程的第(十二)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上两篇文章Linux Shell系列教程之(十)Shell for循环和Lin ...

随机推荐

  1. python--Numpy and Pandas 笔记01

    博客地址:http://www.cnblogs.com/yudanqu/ 1 import numpy as np import pandas as pd from pandas import Ser ...

  2. k8s

    https://www.cnblogs.com/sheng-jie/p/10591794.html

  3. python中各个response使用

    Python django中我们经常用的response有django中的 JsonResponse, HttpResponse,还有DRF中的Response 在使用的时候,经常会不知道如何什么时候 ...

  4. 在IDEA中配置Spring的XML装配

    不考虑混合模式的话,Spring有三类装配Bean的方法,自动装配和Java代码装配都会很容易上手,但在弄XML装配时遇到了问题,这与IDEA环境有关. 装配时需要在源码中配置XML文件的位置,我看别 ...

  5. Python_匿名函数

    匿名函数:为了解决那些功能很简单的需求而设计的一句话函数. 代码如下: 1 正常函数: 2 3 def calc(n): 4 5 return n ** n 6 7 print(calc(10)) 8 ...

  6. hihoCoder1033 交错和 数位DP

    题目:交错和 链接:http://hihocoder.com/problemset/problem/1033# 题意:对于一个十进制整数x,令a0.a1.a2.....an是x从高位到低位的数位,定义 ...

  7. 【学亮IT手记】jQuery each()函数用法实例

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...

  8. cookie路径概念理解

    .创建一个cookie并设置 cookie的有效路径: $.cookie('the_cookie', 'the_value', { expires: 7, path: '/' }); 注:在默认情况下 ...

  9. If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

    学习Spring Boot 过程中遇到了下列这个问题 Description: Failed to configure a DataSource: 'url' attribute is not spe ...

  10. mysql 如何查看sql语句执行时间和效率

    查看执行时间 1 show profiles; 2 show variables;查看profiling 是否是on状态: 3 如果是off,则 set profiling = 1: 4 执行自己的s ...