20.2.3 Finding pathnames on the system

Function: mbfl_file_find_tmpdir
Function: mbfl_file_find_tmpdir PATHNAME
Function: mbfl_file_find_tmpdir_var _RV
Function: mbfl_file_find_tmpdir_var _RV PATHNAME

Find a value for a temporary directory according to the following rules:

  1. If PATHNAME is not used: it defaults to the current value of mbfl_option_TMPDIR.
  2. If PATHNAME is not null and it is a directory and it is writable: it is accepted as value.
  3. If PATHNAME is invalid: the value /tmp/$USER, where USER is the environment variable, is tried.
  4. Finally the value /tmp is tried.

Echo the accepted value to stdout. Return true if a value is found, false otherwise.

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


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