getconf command examples
getconf – get configuration values
The following example illustrates the value of {NGROUPS_MAX}:
getconf NGROUPS_MAX
The following example illustrates the value of {NAME_MAX} for a specific directory:
getconf NAME_MAX /usr
The following example shows how to deal more carefully with results that might be unspecified:
if value=$(getconf PATH_MAX /usr); then if [ "$value" = "undefined" ]; then echo PATH_MAX in /usr is infinite. else echo PATH_MAX in /usr is $value. fi else echo Error in getconf. fi
Note that:
sysconf(_SC_POSIX_C_BIND);
and:
system("getconf POSIX2_C_BIND");
in a C program could give different answers. The sysconf() call supplies a value that corresponds to the conditions when the program was either compiled or executed, depending on the implementation; the system() call to getconf always supplies a value corresponding to conditions when the program is executed.