.shinit (515B)
1 [ -n "${SHINIT_LOADED:-}" ] && return 2 SHINIT_LOADED=1 3 4 sourcefile() { 5 if [ $# -ne 1 ]; then 6 echo "Usage: sourcefile FILE" >&2 7 return 1 8 fi 9 10 if [ -f "$1" ]; then 11 . "$1" 12 else 13 echo "sourcefile: file not found: $1" >&2 14 fi 15 16 return 0 17 } 18 19 sourcedir() { 20 if [ $# -ne 1 ]; then 21 echo "Usage: sourcedir DIR" >&2 22 return 1 23 fi 24 25 if [ -d "$1" ]; then 26 for f in "$1"/*.sh; do 27 sourcefile "$f" 28 done 29 unset f 30 else 31 echo "sourcedir: dir not found: $1" >&2 32 fi 33 34 return 0 35 } 36 37 sourcedir "$HOME"/.config/shinit.d