#!/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"

  

最新文章

  1. C#设计模式-中介者模式
  2. python虚拟机中的异常流控制
  3. 用onerror处理图片获取失败问题
  4. 获取iOS设备型号iphone ipad
  5. Tomcat7启动log打印到INFO: At least one JAR was scanned for TLDs yet contained no TLDs.就停止不动了
  6. JS简单的图片左右滚动
  7. TreeView Class Key Points
  8. javascript 内置对象
  9. C++中this指针的用法详解(转)
  10. CodeForces 617C【序枚举】
  11. Qt窗体关闭时,如何自动销毁窗体类对象
  12. JAVA操作数据库插入中文表中显示乱码的解决方法
  13. 使用RecyclerView写树形结构的TreeRecyclerView
  14. 类似微博菜单 ,用swift语言编写
  15. SQL Server(函数) 关键字的使用 三
  16. MyReport报表引擎2.7.6.7新功能
  17. CodeForces 621A Wet Shark and Odd and Even
  18. python数据类型(二)
  19. FPGA学习笔记(二)——FPGA学习路线及开发流程
  20. Outlook IMAP 修改PST文件存储路径

热门文章

  1. 深入浅出Tomcat系列
  2. Dockerfile centos7_tomcat7.0.64_jdk7u80
  3. H5 video标签的第二种格式
  4. codeforces#580 D. Kefa and Dishes(状压dp)
  5. Mysql数据库触发器调用脚本
  6. openstack-KVM管理工具
  7. pdf中内嵌字体问题
  8. Python爬虫:爬取人人都是产品经理的数据
  9. Git - 常见错误与解决方案
  10. echo "" > 和 echo "" >> 的区别