20.4 Inspecting files and directories

The GNU Coreutils package comes with a command line program stat which implements advanced inspection of file and directory status. See Report file or file system status.

Function: mbfl_file_enable_stat

Declare the intention to use the program stat.

Function: mbfl_file_stat PATHNAME OPT
Function: mbfl_file_stat_var _RV PATHNAME OPT

Execute the program stat with PATHNAME as first argument and the optional arguments OPT inserted in the command line as options.

mbfl_file_enable_stat

mbfl_file_stat /bin/ls --format='%F'
⇒ 0
-| regular

mbfl_file_stat /bin --format='%F'
⇒ 0
-| directory

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

Function: mbfl_file_get_size PATHNAME
Function: mbfl_file_get_size_var _RV PATHNAME

Print the size of the file in bytes.

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

Function: mbfl_exec_stat ARG

Execute the program stat using the given optional command line arguments.


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