Skip to content

Misc

Index

misc::this_script_dir

Print the directory containing the calling script (resolved at call time via BASH_SOURCE). Useful for computing paths relative to the script's own location, e.g.: path::remove "$(misc::this_script_dir)" Output: stdout — absolute path of the calling script's directory shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites

Function has no arguments.

misc::auto_answer

Return true if the SCRIPTS_AUTO_ANSWER env var is set to 'y' or 'Y'. Used to non-interactively accept all prompts in automated runs. shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites

Function has no arguments.

misc::exec_gui

Launch a GUI app detached from the terminal. Replaces the calling shell via exec; the launched process runs in a new session (via setsid --fork) with stdout and stderr discarded. Must be the last statement in the calling script — exec does not return. Use this instead of cmd "$@" > '/dev/null' 2>&1 & + disown (backgrounded commands are banned because their exit status does not propagate to the parent).

Arguments

  • $1 (GUI): executable name or path
  • ... (remaining): args passed verbatim to the GUI executable