Improve rc/ scripts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# $LWS/rc/functions.sh
|
||||
|
||||
function xlog() {
|
||||
if (( $LWS_DEBUG )); then
|
||||
if true_false "$LWS_DEBUG"; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
@@ -33,7 +33,7 @@ function append_path() {
|
||||
|
||||
function append_path_try() {
|
||||
if [[ -e "$1" ]]; then
|
||||
append_pat "$1"
|
||||
append_path "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -69,13 +69,17 @@ function can_run() {
|
||||
function source_directory() {
|
||||
local mask="$1"
|
||||
for file in $mask; do
|
||||
if [[ -f "$file" ]]; then
|
||||
if [[ -e "$file" ]]; then
|
||||
xlog "LOAD $file"
|
||||
source "$file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function source_directory_sh() {
|
||||
source_directory "$1/*.sh"
|
||||
}
|
||||
|
||||
# use: dump_args "$@"
|
||||
function dump_args() {
|
||||
for i in $*; do
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
alias nop=':'
|
||||
|
||||
alias exit-when-error='set -o errexit'
|
||||
alias exit-when-unset-variable='set -o nounset'
|
||||
alias exit-when-pipe-fail='set -o pipefail'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# Load user locals bashrc
|
||||
|
||||
source_directory "$HOME/.bashrc.d/*.sh"
|
||||
source_directory_sh "$LWS/rc.local"
|
||||
source_directory_sh "$HOME/.bashrc.d"
|
||||
|
||||
Reference in New Issue
Block a user