Add script for listing /etc/passwd users
This commit is contained in:
parent
460cf2d25b
commit
48b53ecf99
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
USUARIO=$1
|
||||
TITULOS=( "Nombre" "Contraseña" "UID" "GID" "Comentario" "Directorio Home" "Shell" )
|
||||
|
||||
# if [[ -z $USUARIO ]]; then
|
||||
# echo "Usage: ./script1.sh root"
|
||||
# exit
|
||||
# fi
|
||||
#
|
||||
|
||||
getUserInfo() {
|
||||
USER=$1
|
||||
IFS=':'
|
||||
COUNT=0
|
||||
for v in $USER; do
|
||||
echo "${TITULOS[$COUNT]}: $v"
|
||||
let COUNT++
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
while read -r v; do
|
||||
# I hate this
|
||||
getUserInfo "$v"
|
||||
echo "--------------------"
|
||||
done</etc/passwd
|
||||
}
|
||||
|
||||
main
|
Loading…
Reference in New Issue