[root@localhost ~]# vim user.sh 
  1 #!/bin/bash
  2 for i in `cut -d ":" -f1 /etc/passwd`;
  3 do
  4 echo -e "Hello User:" "\033[31m$i\033[0m"  "shell is" "\033[33
    m`grep $i /etc/passwd|cut -d ":" -f7`\033[0m""."
  5 done
 Linux_simpl shell-利用Shell脚本for循环输出系统中的用户及其Shell Linux

 

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄