The following functions inspect entries from /etc/group using an index argument; we must obtain indexes with the functions described in Searching entries from /etc/group.
Print to stdout
the field name of the /etc/group entry at index GROUP_IDX.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
local IDX NAME mbfl_system_group_read if mbfl_system_group_find_entry_by_name_var IDX root then if mbfl_system_group_get_name_var NAME $IDX then echo "$NAME" fi fi
Print to stdout
the field passwd of the /etc/group entry at index GROUP_IDX.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
Print to stdout
the field gid of the /etc/group entry at index GROUP_IDX.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
Print to stdout
the field users of the /etc/group entry at index GROUP_IDX.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
Print to stdout
the number of user names in the list of users for the entry at index
GROUP_IDX.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
Print to stdout
the name of the user at index USER_IDX in the list of users for the
entry at index GROUP_IDX.
The function variant _var
stores the result in the variable _RV, rather than print it;
Result variables.
local -i GROUP_IDX USER_COUNT USER_IDX local USER_NAME mbfl_system_group_read if GROUP_IDX=$(mbfl_system_group_find_entry_by_name root) then USER_COUNT=$(mbfl_system_group_get_users_count $GROUP_IDX) for ((USER_IDX=0; USER_IDX < USER_COUNT; ++USER_IDX)) do mbfl_system_group_get_user_name $GROUP_IDX $USER_IDX done fi # Using the "_var" variants. if mbfl_system_group_find_entry_by_name_var GROUP_IDX root then mbfl_system_group_get_users_count_var USER_COUNT $GROUP_IDX for ((USER_IDX=0; USER_IDX < USER_COUNT; ++USER_IDX)) do mbfl_system_group_get_user_name_var USER_NAME \ $GROUP_IDX $USER_IDX echo "$USER_NAME" done else return 1 fi
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.