diff --git a/.helpers/foreach-script b/.helpers/foreach-script index 79b0c3a..e61406a 100755 --- a/.helpers/foreach-script +++ b/.helpers/foreach-script @@ -10,6 +10,11 @@ VERBOSE=${VERBOSE:="0"} +__is_file_bash_or_sh() { + [[ ${1} == *.bash || ${1} == *.sh ]] || + file "${1}" | grep -qE 'shell script|POSIX shell script|Bourne-Again shell script|bash script|a sh script' +} + mapfile -d '' -t files < <( find ./ \ -type f \ @@ -21,7 +26,7 @@ mapfile -d '' -t files < <( status=0 for file in "${files[@]}"; do - if file "${file}" | grep -qE 'shell script|POSIX shell script|Bourne-Again shell script|bash script|a sh script'; then + if __is_file_bash_or_sh "${file}"; then [[ ${VERBOSE} == "1" ]] && echo "${*} ${file}" "${@}" "${file}" || status=1 fi diff --git a/.helpers/shellcheck b/.helpers/shellcheck index d43c98e..0dde354 100755 --- a/.helpers/shellcheck +++ b/.helpers/shellcheck @@ -15,9 +15,11 @@ fi --exclude=SC2012 \ --exclude=SC2002 \ --exclude=SC2059 \ - --exclude=SC2181 + --exclude=SC2181 \ + --exclude=SC1091 # SC2012 (info): Use find instead of ls to better handle non-alphanumeric filenames. https://www.shellcheck.net/wiki/SC2012 # SC2059 (info): Don't use variables in the printf format string. https://www.shellcheck.net/wiki/SC2059 # SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. https://www.shellcheck.net/wiki/SC2002 # SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. https://www.shellcheck.net/wiki/SC2181 +# SC1091 (info): Not following: /usr/share/fzf/shell/key-bindings.bash: openBinaryFile: does not exist (No such file or directory). https://www.shellcheck.net/wiki/SC1091 diff --git a/README.md b/README.md index 5d27848..7d88171 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,3 @@ Run `install`. $ ln -s /path/to/dotfiles/root.bash ~/.dotfiles.bash $ echo '[[ -r ~/.dotfiles.bash ]] && [[ -f ~/.dotfiles.bash ]] && source ~/.dotfiles.bashh' >> ~/.bashrc ``` - -#### Notes - -Create the file `~/.path` and put what ever path that you want to be included to PATH (paths can contain environment variables). diff --git a/bin/colors-sample b/bin/colors-sample index 891471b..b8125b1 100755 --- a/bin/colors-sample +++ b/bin/colors-sample @@ -84,7 +84,7 @@ __msg2() { } __boxline() { - for v in "$@"; do + for v in "${@}"; do __msg2 "${v}" done echo "" diff --git a/bin/provides b/bin/provides index b6b5adb..3b458ff 100755 --- a/bin/provides +++ b/bin/provides @@ -2,10 +2,10 @@ case "$(what-pm)" in "dnf") - dnf provides "$@" + dnf provides "${@}" ;; "apt") - dpkg -S "$@" + dpkg -S "${@}" ;; *) echo "this script does not supports this distro" diff --git a/config/gnome/lib/display-colors b/config/gnome/lib/display-colors index 2ca190f..a28f512 100755 --- a/config/gnome/lib/display-colors +++ b/config/gnome/lib/display-colors @@ -1,7 +1,8 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "$1" +# https://www.shellcheck.net/wiki/SC1090 +# shellcheck source=/dev/null +source "${1}" echo "FG : ${C_FG}" echo "BG : ${C_BG}" diff --git a/lib/00-common.bash b/lib/00-common.bash index 5a019ad..d6e0612 100644 --- a/lib/00-common.bash +++ b/lib/00-common.bash @@ -15,4 +15,3 @@ bb() { local cmd='source-highlight --no-doc --out-format=esc --tab=2' ${cmd} --infer-lang --input "${@}" 2>/dev/null || ${cmd} --src-lang=shell --input "${@}" } - diff --git a/lib/00-homebrew.bash b/lib/00-homebrew.bash index 78653bf..2dd2afc 100644 --- a/lib/00-homebrew.bash +++ b/lib/00-homebrew.bash @@ -5,6 +5,8 @@ init-linuxbrew() { if [ -d "${HOMEBREW_PREFIX}/etc/bash_completion.d" ]; then for rc in "${HOMEBREW_PREFIX}/etc/bash_completion.d"/*; do if [ -f "${rc}" ]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source "${rc}" fi done @@ -20,13 +22,16 @@ case "$(uname)" in if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then export BASH_COMPLETION_COMPAT_DIR="${HOMEBREW_PREFIX}/etc/bash_completion.d" + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" fi ;; "Linux") - [[ "${__DISABLE_LINUXBREW}" == 'true' ]] && return 0 + [[ ${__DISABLE_LINUXBREW} == 'true' ]] && return 0 init-linuxbrew ;; + *) ;; esac diff --git a/lib/00-pathmixer.bash b/lib/00-pathmixer.bash index 8667b15..b41c482 100644 --- a/lib/00-pathmixer.bash +++ b/lib/00-pathmixer.bash @@ -1,26 +1,15 @@ path-add() { - if [[ "${1}" == "" ]]; then + if [[ ${1} == "" ]]; then return fi - if [[ ":${PATH}:" != *":${1}:"* ]] ; then - if [[ "${2}" = "after" ]] ; then + if [[ ":${PATH}:" != *":${1}:"* ]]; then + if [[ ${2} == "after" ]]; then PATH=${PATH}:${1} else PATH=${1}:${PATH} fi fi - export PATH; -} - -load-path-file() { - if [ -f ~/.path ]; then - while read p; do - [[ ${p} = "" ]] && continue - p=$(eval echo \"${p}\") - path-add ${p} - done < ~/.path - unset p - fi + export PATH } diff --git a/lib/10-linux.bash b/lib/10-linux.bash index e4f1dc6..0492658 100644 --- a/lib/10-linux.bash +++ b/lib/10-linux.bash @@ -4,12 +4,11 @@ fi ################################################################################ ######### Paths ################################################################ -path-add ${HOME}/.local/bin -path-add ${HOME}/bin +path-add "${HOME}/.local/bin" +path-add "${HOME}/bin" ################################################################################ ################################################################################ - ################################################################################ ######### Aliases and Functions ################################################ alias O='xdg-open' @@ -30,7 +29,7 @@ alias dnf-display-package-contents='dnf repoquery -l' alias dnf-display-local-package-contents='dnf repoquery --installed -l' sizes-files() { - du --human-readable --max-depth=1 --all | sort --human-numeric-sort --reverse + du --human-readable --max-depth=1 --all | sort --human-numeric-sort --reverse } export -f sizes-files sizes-disks() { @@ -52,5 +51,5 @@ export -f apt-clean-uninstalled export EDITOR=/usr/bin/vim -[[ -e $HOME/.dir_colors ]] && eval "$(dircolors --bourne-shell ~/.dir_colors)" +[[ -e "${HOME}/.dir_colors" ]] && eval "$(dircolors --bourne-shell "${HOME}/.dir_colors")" # dircolors --print-database > ~/.dir_colors diff --git a/lib/10-macos.bash b/lib/10-macos.bash index a07e73e..0c09e49 100644 --- a/lib/10-macos.bash +++ b/lib/10-macos.bash @@ -46,13 +46,13 @@ if [[ -d "${HOMEBREW_PREFIX}/opt/curl/bin" ]]; then alias curl="\${HOMEBREW_PREFIX}/opt/curl/bin/curl" fi -export LANG='en_US.UTF-8'; -export LC_ALL='en_US.UTF-8'; +export LANG='en_US.UTF-8' +export LC_ALL='en_US.UTF-8' install-nano-nanorc() { touch ~/.nanorc for rcfile in "$(brew --prefix nano)"/share/nano/*.nanorc; do - echo "include ${rcfile}" >> ~/.nanorc + echo "include ${rcfile}" >>~/.nanorc done } diff --git a/lib/20-ps1.bash b/lib/20-ps1.bash index e6acc05..c58394a 100644 --- a/lib/20-ps1.bash +++ b/lib/20-ps1.bash @@ -58,73 +58,67 @@ ################################################################################ __ps1_color() { - if [[ "$#" = 0 ]]; then + if [[ $# == 0 ]]; then printf "\[\e[0m\]" else printf "\[\e[${1};${2};${3}m\]" fi } -declare -A __PS1_COLORS=( \ - ["reset"]="$(__ps1_color)" \ - ["prefix"]="$(__ps1_color 1 49 35)" \ - ["main"]="$(__ps1_color 0 49 90)" \ - ["seperator"]="$(__ps1_color 0 49 37)" \ - ["user"]="$(__ps1_color 0 49 32)" \ - ["root"]="$(__ps1_color 0 49 31)" \ - ["path"]="$(__ps1_color 0 49 36)" \ - ["git"]="$(__ps1_color 0 49 93)" \ - ["gitwrap"]="$(__ps1_color 0 49 33)" \ - ["kube_context"]="$(__ps1_color 1 49 34)" \ - ["kube_nsp"]="$(__ps1_color 0 49 37)" \ +declare -A __PS1_COLORS=( + ["reset"]="$(__ps1_color)" + ["prefix"]="$(__ps1_color 1 49 35)" + ["main"]="$(__ps1_color 0 49 90)" + ["seperator"]="$(__ps1_color 0 49 37)" + ["user"]="$(__ps1_color 0 49 32)" + ["root"]="$(__ps1_color 0 49 31)" + ["path"]="$(__ps1_color 0 49 36)" + ["git"]="$(__ps1_color 0 49 93)" + ["gitwrap"]="$(__ps1_color 0 49 33)" + ["kube_context"]="$(__ps1_color 1 49 34)" + ["kube_nsp"]="$(__ps1_color 0 49 37)" ) - - __ps1_seperator() { #local DSEP=${__PS1_SEPERATOR:-$' \u2423 '} # https://codepoints.net/U+2423 #local DSEP=${__PS1_SEPERATOR:-$' \u203F '} # https://codepoints.net/U+203F #local DSEP=${__PS1_SEPERATOR:-$' \u2219 '} # https://codepoints.net/U+2219 - local DSEP=${__PS1_SEPERATOR:-$' \u2022 '} # https://codepoints.net/U+2022 + local DSEP=${__PS1_SEPERATOR:-$' \u2022 '} # https://codepoints.net/U+2022 #local DSEP=${__PS1_SEPERATOR:-$' '} - printf "%s%s%s" "${__PS1_COLORS[seperator]}" "$DSEP" "${__PS1_COLORS[reset]}" + printf "%s%s%s" "${__PS1_COLORS[seperator]}" "${DSEP}" "${__PS1_COLORS[reset]}" } - __ps1_user() { local disp=${__PS1_DISPLAY_USER:-false} - if [[ "${disp}" == 'false' ]] && [[ ! "`id -u`" -eq 0 ]]; then + if [[ ${disp} == 'false' ]] && [[ ! "$(id -u)" -eq 0 ]]; then return fi local USR="${__PS1_COLORS[user]}${USER}${__PS1_COLORS[reset]}" - if [[ "`id -u`" -eq 0 ]]; then + if [[ "$(id -u)" -eq 0 ]]; then USR="${__PS1_COLORS[root]}root${__PS1_COLORS[reset]}" fi printf "%s" "${USR}" } - __ps1_host() { local disp=${__PS1_DISPLAY_HOSTNAME:-false} - if [[ "${disp}" == 'false' ]]; then + if [[ ${disp} == 'false' ]]; then return fi - local TO_PRINT=${__PS1_HOSTNAME:-$HOSTNAME} + local TO_PRINT=${__PS1_HOSTNAME:-${HOSTNAME}} printf "%s%s%s" "${__PS1_COLORS[user]}" "${TO_PRINT}" "${__PS1_COLORS[reset]}" } - __ps1_pwd() { printf "%s\w%s" \ "${__PS1_COLORS[path]}" \ "${__PS1_COLORS[reset]}" } - export GIT_PS1_SHOWDIRTYSTATE=true export GIT_PS1_SHOWUNTRACKEDFILES=true export GIT_PS1_SHOWUPSTREAM="verbose name" @@ -139,7 +133,7 @@ __ps1_git() { local gitp gitp="$(__git_ps1 '%s')" - if [[ -n "${gitp}" ]]; then + if [[ -n ${gitp} ]]; then printf "%s%s%s%s%s%s" \ "${__PS1_COLORS[gitwrap]}" \ $'\uE0A0 ' \ @@ -150,9 +144,8 @@ __ps1_git() { fi } - __ps1_kube() { - if [[ -z "${__PS1_DISPLAY_KUBE-}" ]] || [[ ! -x "$(command -v kubectl)" ]]; then + if [[ -z ${__PS1_DISPLAY_KUBE-} ]] || [[ ! -x "$(command -v kubectl)" ]]; then return fi @@ -167,20 +160,20 @@ __ps1_join() { sep="$(__ps1_seperator)" local BUF="" - if [[ "$#" -eq 0 ]]; then + if [[ $# -eq 0 ]]; then return fi for fn in "${@}"; do - [[ -z "$fn" ]] && continue - if [[ "${BUF}" == "" ]]; then + [[ -z ${fn} ]] && continue + if [[ ${BUF} == "" ]]; then BUF="${fn}" continue fi BUF="${BUF}${sep}${fn}" done - printf "%s" "$BUF" + printf "%s" "${BUF}" } __ps1() { @@ -201,9 +194,8 @@ __ps1() { export PROMPT_COMMAND=__ps1 - ps1-kube() { - if [[ -n "${__PS1_DISPLAY_KUBE-}" ]]; then + if [[ -n ${__PS1_DISPLAY_KUBE-} ]]; then unset __PS1_DISPLAY_KUBE else export __PS1_DISPLAY_KUBE=true diff --git a/lib/21-starship.bash b/lib/21-starship.bash index 73c652d..2f5dfd0 100644 --- a/lib/21-starship.bash +++ b/lib/21-starship.bash @@ -1,4 +1,4 @@ -if command -v starship &> /dev/null; then +if command -v starship &>/dev/null; then export STARSHIP_CONFIG="${DOTFILES_PATH}/config/starship/starship.toml" eval "$(starship init bash)" fi diff --git a/lib/50-docker.bash b/lib/50-docker.bash index 92ff7fd..b71c693 100644 --- a/lib/50-docker.bash +++ b/lib/50-docker.bash @@ -3,8 +3,8 @@ alias docker-clean-volumes='docker volume rm $(docker volume ls -qf dangling=tru docker-stop-all() { for i in $(docker ps --format "{{.Names}}"); do printf "Stoping %s ... " "${i}" - docker stop ${i} > /dev/null - if [ $? -eq 0 ]; then + docker stop "${i}" >/dev/null + if [[ $? -eq 0 ]]; then printf "\e[1;32mDone!\e[m\n" else printf "\e[1;31mFailed!\e[m\n" @@ -12,15 +12,18 @@ docker-stop-all() { done } -docker-clean-all() {( set -x +docker-clean-all() { ( + set -x # --force Do not prompt for confirmation docker system prune --force docker image prune --force docker network prune --force docker volume prune --force -)} +); } if command -v dr 1>/dev/null 2>&1; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source <(dr --completion) fi @@ -28,11 +31,15 @@ fi ################# macos docker ################################################# source-docker-bash-completion() { local etc=/Applications/Docker.app/Contents/Resources/etc - if [[ -f ${etc}/docker.bash-completion ]]; then - source ${etc}/docker.bash-completion + if [[ -f "${etc}/docker.bash-completion" ]]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null + source "${etc}/docker.bash-completion" fi if [[ -f ${etc}/docker-compose.bash-completion ]]; then - source ${etc}/docker-compose.bash-completion + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null + source "${etc}/docker-compose.bash-completion" fi } export -f source-docker-bash-completion diff --git a/lib/50-go.bash b/lib/50-go.bash index a7e3452..f8c98bc 100644 --- a/lib/50-go.bash +++ b/lib/50-go.bash @@ -18,25 +18,25 @@ if command -v go 1>/dev/null 2>&1; then fi if command -v golangci-lint 1>/dev/null 2>&1; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source <(golangci-lint completion bash) fi -go-test() { +go-test() { ( + set -x # -p=1 -v - (set -x - go test -timeout=60s -count=1 -race "${*}" ./... - ) -} + go test -timeout=60s -count=1 -race "${@}" ./... +); } -go-build() { - (set -x - go build -trimpath -ldflags '-s -w' "${*}" - ) -} +go-build() { ( + set -x + go build -trimpath -ldflags '-s -w' "${@}" +); } go-install() { echo -e "> go install \e[0;35m${*}\e[0m" - #go install -a -trimpath -ldflags '-s -w' "$@" + #go install -a -trimpath -ldflags '-s -w' "${@}" #go install -trimpath -ldflags '-s -w' "${@}" go install "${@}" } @@ -50,15 +50,8 @@ go-update-all-mods() { go mod tidy } -install-go-tools() {( +install-go-tools() { ( export CGO_ENABLED=0 - #__install_binary() { - # for v in "$@"; do - # echo -e " moving \e[0;90m${v}\e[0m -> \e[0;32m/usr/local/bin\e[0m" - # done - # sudo install --mode=755 --group=root --owner=root --target-directory=/usr/local/bin/ "$@" - # rm -rf "$@" - #} # https://github.com/go-delve/delve/releases go-install github.com/go-delve/delve/cmd/dlv@latest @@ -125,12 +118,13 @@ install-go-tools() {( #go-install github.com/elastic/elastic-package@latest #go-install github.com/cashapp/hermit/cmd/hermit@latest -)} +); } # Where is the go ENV file? # Linux you'll get $HOME/. config/go/env # macOS you'll get $HOME/Library/Application Support/go/env install-hugo() { + # https://github.com/gohugoio/hugo?tab=readme-ov-file#build-from-source CGO_ENABLED=1 go install -tags extended -trimpath -ldflags '-s -w' github.com/gohugoio/hugo@latest -} \ No newline at end of file +} diff --git a/lib/50-kube.bash b/lib/50-kube.bash index 66c411f..429d909 100644 --- a/lib/50-kube.bash +++ b/lib/50-kube.bash @@ -1,9 +1,10 @@ - -install-kubectl() {( - ${DOTFILES_PATH}/scripts/install-kubectl "$@" -)} +install-kubectl() { + "${DOTFILES_PATH}/scripts/install-kubectl" "${@}" +} if [[ -x /usr/local/bin/kubectl ]]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source <(kubectl completion bash) alias k=kubectl complete -F __start_kubectl k diff --git a/lib/50-misc.bash b/lib/50-misc.bash index deb3a51..ebb27a7 100644 --- a/lib/50-misc.bash +++ b/lib/50-misc.bash @@ -1,13 +1,13 @@ ################################################## ## zoxide ## if [[ -x /usr/bin/zoxide ]]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source <(zoxide init bash) fi ## ## ################################################## - - ################################################## ## fzf ## # https://github.com/junegunn/fzf @@ -22,26 +22,24 @@ fi ## ## ################################################## - - ################################################## ## aws ## if [[ -x /usr/local/bin/aws_completer ]]; then complete -C "$(which aws_completer)" aws fi -install-awscli2() {( - "${DOTFILES_PATH}/scripts/install-awscli2" "$@" -)} +install-awscli2() { + "${DOTFILES_PATH}/scripts/install-awscli2" "${@}" +} # sudo snap install aws-cli --classic ## ## ################################################## - - ################################################## ## git ## if [[ -x /usr/local/bin/gh ]]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source <(gh completion --shell bash) fi @@ -49,8 +47,6 @@ alias gcl='git config --local --list' ## ## ################################################## - - ################################################## ## java ## alias java-ls='ll /etc/alternatives | grep /usr/lib/jvm | column -t' diff --git a/lib/50-python.bash b/lib/50-python.bash index d52dc2f..ff45545 100644 --- a/lib/50-python.bash +++ b/lib/50-python.bash @@ -19,8 +19,12 @@ alias pip3-list='pip3 list --user' load-pip3-autocompletion() { if command -v "${HOME}/.local/bin/pip3" 1>/dev/null 2>&1; then - source <(${HOME}/.local/bin/pip3 completion --bash) + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null + source <("${HOME}/.local/bin/pip3" completion --bash) elif command -v /usr/bin/pip3 1>/dev/null 2>&1; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source <(/usr/bin/pip3 completion --bash) fi } diff --git a/lib/90-ww.bash b/lib/90-ww.bash index e45198c..a700dc7 100644 --- a/lib/90-ww.bash +++ b/lib/90-ww.bash @@ -1,5 +1,5 @@ ww() { - if ! type -t "${1}" &> /dev/null; then + if ! type -t "${1}" &>/dev/null; then echo -e "\e[0;31mNot found\e[0m" return fi @@ -9,11 +9,11 @@ ww() { local type_of type_of="$(type -t "${1}")" - if [[ "${type_of}" == 'function' ]]; then + if [[ ${type_of} == 'function' ]]; then declare -f "${1}" | ${cat_cmd} --src-lang=shell return fi - if [[ "${type_of}" == 'alias' ]]; then + if [[ ${type_of} == 'alias' ]]; then alias "${1}" | ${cat_cmd} --src-lang=shell return fi @@ -22,12 +22,12 @@ ww() { full_path="$(which "${1}")" local file_of file_of="$(file "${full_path}")" - if [[ "${file_of}" == *text* ]]; then + if [[ ${file_of} == *text* ]]; then ${cat_cmd} --infer-lang --input="${full_path}" 2>/dev/null || ${cat_cmd} --src-lang=shell --input="${full_path}" return fi - if [[ "${file_of}" == *symbolic\ link* ]]; then + if [[ ${file_of} == *symbolic\ link* ]]; then echo -e "\e[0;37mFile:\e[0m \e[0;36m${full_path}\e[0m \e[0;90m${file_of}\e[0m " fi @@ -38,10 +38,13 @@ ww() { "Linux") full_path="$(realpath --logical "${full_path}")" ;; + *) + full_path="$(realpath "${full_path}")" + ;; esac file_of="$(file "${full_path}")" - if [[ "${file_of}" == *text* ]]; then + if [[ ${file_of} == *text* ]]; then ${cat_cmd} --infer-lang --input="${full_path}" 2>/dev/null || ${cat_cmd} --src-lang=shell --input="${full_path}" return fi @@ -49,4 +52,4 @@ ww() { echo -e "\e[0;37mFile:\e[0m \e[0;36m${full_path}\e[0m \e[0;90m${file_of}\e[0m " } export -f ww -complete -c ww \ No newline at end of file +complete -c ww diff --git a/notes/bash_cheatsheet.md b/notes/bash_cheatsheet.md new file mode 100644 index 0000000..c825888 --- /dev/null +++ b/notes/bash_cheatsheet.md @@ -0,0 +1,4 @@ +### ${@} vs. ${*} + * ${@}: Expands each positional parameter into a separate word. When quoted as "${@}", it becomes "$1" "$2" "$3", preserving the separation of arguments—even if they contain spaces. + * ${*}: Expands all positional parameters into a single word. When quoted as "${*}", it becomes "$1 $2 $3", concatenating all arguments into one string separated by the first character of the IFS (Internal Field Separator, usually a space). + diff --git a/root.bash b/root.bash index 17e47fd..a6bdcb4 100644 --- a/root.bash +++ b/root.bash @@ -10,14 +10,17 @@ path-read-link() { "Linux") readlink --canonicalize-existing --no-newline "${1}" ;; + *) + readlink -n "${1}" + ;; esac } path-real() { local SOURCE="${1}" - while [[ -L "${SOURCE}" ]]; do + while [[ -L ${SOURCE} ]]; do SOURCE="$(path-read-link "${SOURCE}")" - [[ "${SOURCE}" != /* ]] && SOURCE="$(path-abs "${SOURCE}")/${SOURCE}" + [[ ${SOURCE} != /* ]] && SOURCE="$(path-abs "${SOURCE}")/${SOURCE}" done path-abs "${SOURCE}" } @@ -28,20 +31,26 @@ export DOTFILES_PATH ################################################################################ ######### Source libs ########################################################## for src in "${DOTFILES_PATH}"/lib/*.bash; do - if [[ -r "${src}" ]]; then + if [[ -r ${src} ]]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source "${src}" fi done unset src for src in "${DOTFILES_PATH}"/extras-*; do + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source "${src}" done 2>/dev/null unset src if [[ -d "${HOME}"/.bashrc.d ]]; then for src in "${HOME}"/.bashrc.d/*; do - if [[ -f "${src}" ]]; then + if [[ -f ${src} ]]; then + # https://www.shellcheck.net/wiki/SC1090 + # shellcheck source=/dev/null source "${src}" fi done diff --git a/scripts/install-fonts-locally b/scripts/install-fonts-locally index 25282bd..a49d82a 100755 --- a/scripts/install-fonts-locally +++ b/scripts/install-fonts-locally @@ -490,7 +490,7 @@ __FNT_ALL=( __LP=() if [[ $# -gt 0 ]]; then - __LP=("$@") + __LP=("${@}") else __LP=("${__FNT_ALL[@]}") fi