caio.co/de/bash.d

bashd_source: Allow skipping -x test with the '-f' flag

Id
b084f1c5a74351d415c508c3253785094137831d
Author
Caio
Commit time
2013-11-24T13:31:22-02:00

Modified core/init.bash

@@ -40,8 +40,15
}

bashd_source() {
+ local must_be_executable=1
+
+ if [ "$1" = "-f" ]; then
+ must_be_executable=0
+ shift
+ fi
+
for file in ${@}; do
- test ! -f ${file} -o ! -x ${file} && continue
+ test ! -f ${file} -o \( $must_be_executable = 1 -a ! -x ${file} \) && continue
. ${file} || _bashd_error "Unable to load ${file}"
done
}