diff --git a/sh/lint/shellcheck.sh b/sh/lint/shellcheck.sh index 0cbe758..ac8c700 100644 --- a/sh/lint/shellcheck.sh +++ b/sh/lint/shellcheck.sh @@ -3,10 +3,12 @@ rwx_shellcheck() { local file module modules path file="$(mktemp)" modules="$(rwx_find_shell "${root}")" - printf "%s\n" "${modules}" | while IFS= read -r module; do + rwx_ifs_set + for module in ${modules}; do path="${root}/${module}" echo ". \"${path}\"" >>"${file}" done + rwx_ifs_unset rwx_shellcheck_file "${file}" rwx_remove "${file}" } diff --git a/sh/main.sh b/sh/main.sh index 48e7f08..75036ef 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -132,6 +132,23 @@ rwx_shell_interactive() { esac } +# ╭──────┬─────╮ +# │ main │ ifs │ +# ╰──────┴─────╯ + +# set internal field separator to line feed +rwx_ifs_set() { + _RWX_IFS="${IFS}" + IFS=" +" +} + +# unset internal field separator +rwx_ifs_unset() { + IFS="${_RWX_IFS}" + unset RWX_IFS +} + # ╭──────┬──────╮ # │ main │ find │ # ╰──────┴──────╯ diff --git a/sh/self.sh b/sh/self.sh index dfbe203..a7ebca2 100644 --- a/sh/self.sh +++ b/sh/self.sh @@ -181,14 +181,13 @@ rwx_self_write() { local file text text="#! /usr/bin/env sh " - local files="$(rwx_self_subset "${@}")" - while IFS= read -r file; do + rwx_ifs_set + for file in $(rwx_self_subset "${@}"); do text="${text} $(cat "${RWX_ROOT_SYSTEM}/${file}") " - done <