Next: , Previous: , Up: file commands   [Contents][Index]


6.2.10 Set/get file permissions

Function: mbfl_file_enable_permissions

Declare the intention to use the programs required to get/set file permissions. Declaring the intention to use a program

The programs are: stat, chmod.

Function: mbfl_file_get_permissions pathname
Function: mbfl_file_get_permissions_var _RV pathname

Print the access permissions for pathname, in octal format.

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

mbfl_file_get_permissions /bin/ls       -| 0755

local PERMS
mbfl_file_get_permissions_var PERMS /bin/ls
"$_RV" ⇒ 0755

To set permissions one may request the use of sudo: just request a user before invoking the following function. Executing a program

Function: mbfl_file_set_permissions mode pathname

Set the access permissions for pathname; mode must be in a form accepted by chmod.


Next: , Previous: , Up: file commands   [Contents][Index]

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