Mac OS X 系统脚本实用指南
1. 列出 NetInfo 用户
1.1 代码展示
#!/bin/sh # listmacusers - Simple script to list users in the Mac OS X NetInfo database. # Note that Mac OS X also has an /etc/passwd file, but that's # used only during the initial stages of boot time and for # recovery bootups. Otherwise, all data is in the NetInfo db. fields="" while getopts "Aahnprsu" opt ; do case $opt in A ) fields="uid passwd name realname home shell" ;; a ) fields="uid name realname home shell" ;; h ) fields="$fields home" ;; n ) fields="$fields name" ;; p ) fields="$fields passwd" ;; r ) fields="$fields realname" ;