shell脚本取出所有用户的解释器

取出所有用户的默认解释器

#! /bin/bash
__Author__=‘liy‘

function lines()
{
  for line in $(cat /etc/passwd)
  do
    OLDIFS=$IFS
    IFS=":"
    count=0
    for item in ${line}
    do
      [ ${count} -eq 0 ] && user=${item}
      [ ${count} -eq 6 ] && shell=${item}
      let count++
    done
    IFS=${OLDIFS}
    echo "${user}: ${shell}"
  done
}

lines

相关推荐