mirror of
https://github.com/YunoHost-Apps/linuxdash_ynh.git
synced 2024-09-03 19:36:07 +02:00
14 lines
498 B
Bash
14 lines
498 B
Bash
|
#!/bin/bash
|
||
|
result=$(/usr/bin/awk -F: '{ \
|
||
|
if ($3<=499){userType="system";} \
|
||
|
else {userType="user";} \
|
||
|
print "{ \"type\": \"" userType "\"" ", \"user\": \"" $1 "\", \"home\": \"" $6 "\" }," }' < /etc/passwd
|
||
|
)
|
||
|
|
||
|
length=$(echo ${#result})
|
||
|
|
||
|
if [ $length -eq 0 ]; then
|
||
|
result=$(getent passwd | /usr/bin/awk -F: '{ if ($3<=499){userType="system";} else {userType="user";} print "{ \"type\": \"" userType "\"" ", \"user\": \"" $1 "\", \"home\": \"" $6 "\" }," }')
|
||
|
fi
|
||
|
|
||
|
echo [ ${result%?} ]
|