Previous: , Up: system group   [Contents][Index]


19.2.5 Converting group identifiers

We are meant to call these function after a call to mbfl_system_group_read(); Reading the file /etc/group.

Function: mbfl_system_group_gid_to_name gid
Function: mbfl_system_group_gid_to_name_var _RV gid

Print to stdout the name of the group whose gid is gid. When successful return true; otherwise return false.

The function variant _var stores the result in the variable _RV, rather than print it; Result variables.

local GROUP_NAME

if mbfl_system_group_read
then mbfl_system_group_gid_to_name 0
fi

# Using the "_var" variants.
if mbfl_system_group_read
then
    mbfl_system_group_gid_to_name_var GROUP_NAME 0
    echo "$GROUP_NAME"
fi
Function: mbfl_system_group_name_to_gid name
Function: mbfl_system_group_name_to_gid_var _RV name

Print to stdout the id of the group whose gid is gid. When successful return true; otherwise return false.

The function variant _var stores the result in the variable _RV, rather than print it; Result variables.

local GROUP_ID

if mbfl_system_group_read
then mbfl_system_group_name_to_gid 'root'
fi

# Using the "_var" variants.
if mbfl_system_group_read
then
    if mbfl_system_group_name_to_gid_var GROUP_ID 'root'
    then echo "$GROUP_ID"
    fi
fi
Function: mbfl_system_numerical_group_id_to_name id

Convert the numerical group id to the group name found in the /etc/group file; print the result to stdout. When successful return true; otherwise return false.

Function: mbfl_system_numerical_group_id_to_name name

Convert the symbolic group name to the numerical identifier found in the /etc/group file; print the result to stdout. When successful return true; otherwise return false.


Previous: , Up: system group   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.