mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-30 05:02:54 +08:00
add another option
This commit is contained in:
parent
58bf7f16c8
commit
a59fda6056
@ -3,13 +3,20 @@
|
|||||||
# Display groups from id
|
# Display groups from id
|
||||||
if [ "$2" = "1" ]; then
|
if [ "$2" = "1" ]; then
|
||||||
id $1 |tr ',' '\n' |sort -t\( -k 2 |paste - - |column -t
|
id $1 |tr ',' '\n' |sort -t\( -k 2 |paste - - |column -t
|
||||||
|
elif [ "$2" = "2" ]; then
|
||||||
|
# nice print user’s allowed login groups without numbers or parens
|
||||||
|
# translate comma to newline, sort on field after paren, print without paren and strip trailing paren
|
||||||
|
id $1 |tr ',' '\n' |sort -t\( -k 2 |awk -F\( '{print $2}' |tr -d ')'
|
||||||
else
|
else
|
||||||
|
# Default
|
||||||
id $1 |tr ',' '\n' |tr '(' ' ' |tr ')' ' '|sort -t\( -n -k 2 |column -t
|
id $1 |tr ',' '\n' |tr '(' ' ' |tr ')' ' '|sort -t\( -n -k 2 |column -t
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
Example default output:
|
||||||
|
|
||||||
103 netdev
|
103 netdev
|
||||||
108 bluetooth
|
108 bluetooth
|
||||||
109 lpadmin
|
109 lpadmin
|
||||||
@ -23,7 +30,7 @@ exit;
|
|||||||
uid=1000 user gid=1000 user groups=1000 user
|
uid=1000 user gid=1000 user groups=1000 user
|
||||||
|
|
||||||
|
|
||||||
Arg $2 = 1 output = compact and fairly easy to read, useful if a lot of groups are attached:
|
Arg $2 = 1 output == compact and fairly easy to read, useful if a lot of groups are attached:
|
||||||
|
|
||||||
100(_lpoperator) 12(everyone)
|
100(_lpoperator) 12(everyone)
|
||||||
204(_developer) 250(_analyticsusers)
|
204(_developer) 250(_analyticsusers)
|
||||||
@ -37,4 +44,22 @@ Arg $2 = 1 output = compact and fairly easy to read, useful if a lot of groups a
|
|||||||
98(_lpadmin) uid=501(user) gid=20(staff) groups=20(staff)
|
98(_lpadmin) uid=501(user) gid=20(staff) groups=20(staff)
|
||||||
|
|
||||||
|
|
||||||
|
Arg $2 = 2 output == groups-only:
|
||||||
|
|
||||||
|
all_admins_grp
|
||||||
|
apache_admin_dev_grp
|
||||||
|
apache_admin_eite_grp
|
||||||
|
apache_admin_pete_grp
|
||||||
|
|
||||||
|
audio
|
||||||
|
bluetooth
|
||||||
|
cdrom
|
||||||
|
user gid=1000 # NOTE it's not perfect, but useful for grepping
|
||||||
|
dip
|
||||||
|
floppy
|
||||||
|
lpadmin
|
||||||
|
netdev
|
||||||
|
plugdev
|
||||||
|
scanner
|
||||||
|
video
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user