shell-base/modules/utility/filesystem.mod
David Kebler 0d4481e291 refactor: more new session loading to anything under "load" subirectory (by default) still can add additional loading directories as before.
refactor of debug module using BASH_DEBUG as filename in user shell suddirectory  logs/

improved bindfs and btrfs modules
2023-02-22 11:39:34 -08:00

17 lines
387 B
Bash

#!/bin/bash
# must be json as a string, depends on jq
mounted () {
mountpoint "$1" &> /dev/null && echo yes || return 1
}
# peals back sub-directories until if finds a mountpoint
find_mountpoint () {
local dir=$1
if [[ ! $dir = "/" ]]; then
# echo trying $dir for mountpoint
[[ $(mounted $dir) ]] && echo $dir || find_mountpoint "$(dirname $1)"
else
return 1
fi
}