28 lines
475 B
Bash
28 lines
475 B
Bash
|
#!/bin/bash
|
||
|
PASSWD=$(tail -n4 /etc/passwd | cut -d ":" -f 1,3,7)
|
||
|
INFO=("Nombre" "UID" "Shell")
|
||
|
# Recorrer el fichero de usuarios donde quiero que me muestre la información:
|
||
|
# Nombre:
|
||
|
# UID:
|
||
|
# Shell:
|
||
|
#
|
||
|
getUserInfo() {
|
||
|
USER=$1
|
||
|
IFS=':'
|
||
|
COUNT=0
|
||
|
for v in $USER; do
|
||
|
echo "${INFO[$COUNT]}: $v"
|
||
|
let COUNT++
|
||
|
done
|
||
|
}
|
||
|
|
||
|
main() {
|
||
|
echo "-------------------------"
|
||
|
while read -r v; do
|
||
|
getUserInfo "$v"
|
||
|
echo "-------------------------"
|
||
|
done<<<$PASSWD
|
||
|
}
|
||
|
|
||
|
main
|