# ╭──────╮ # │ self │ # ╰──────╯ # ╭──────┬────────╮ # │ self │ subset │ # ╰──────┴────────╯ # TODO move to code module rwx_self_subset() { local argument file root for argument in "${@}"; do root="${RWX_ROOT_SYSTEM}/${argument}" file="${argument}.sh" if [ -d "${root}" ]; then local file for file in $(rwx_find_shell "${root}"); do echo "${argument}/${file}" done elif [ -f "${RWX_ROOT_SYSTEM}/${file}" ]; then echo "${file}" fi done } # ╭──────┬───────╮ # │ self │ write │ # ╰──────┴───────╯ # TODO move to code module rwx_self_write() { local target="${1}" if [ -n "${target}" ]; then shift local file files text text="#! /usr/bin/env sh " files="$(rwx_self_subset "${@}")" while IFS= read -r file; do text="${text} $(cat "${RWX_ROOT_SYSTEM}/${file}") " done <