From 84c26d227374089fa41bf350af00cfa2069dc930 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 9 Jul 2025 20:07:33 +0200 Subject: [PATCH] =?UTF-8?q?main=20=E2=86=92=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/main.sh | 12 ------------ sh/shell/0.sh | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index a7d1781..d6cc20c 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -43,18 +43,6 @@ rwx_main_find() { sort } -# ╭──────┬───────╮ -# │ main │ shell │ -# ╰──────┴───────╯ - -# test if active shell is in interactive mode -rwx_main_interactive() { - case "${-}" in - *i*) ;; - *) return 1 ;; - esac -} - # ╭──────┬──────╮ # │ main │ main │ # ╰──────┴──────╯ diff --git a/sh/shell/0.sh b/sh/shell/0.sh index 92d5aaa..33a7745 100644 --- a/sh/shell/0.sh +++ b/sh/shell/0.sh @@ -38,10 +38,22 @@ RWX_COLOR_GREEN="$(_rwx_shell_color 31)" RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)" RWX_COLOR_RED="$(_rwx_shell_color 32)" +# ╭───────┬───────────╮ +# │ shell │ variables │ +# ╰───────┴───────────╯ + +# current shell interactive mode +rwx_shell_interactive=0 + # ╭───────┬───────────╮ # │ shell │ functions │ # ╰───────┴───────────╯ +# return current shell interactive mode +rwx_shell_interactive() { + return "${rwx_shell_interactive}" +} + rwx_shell_configure() { [ -n "${ENV}" ] || ENV="${rwx_code_main}" export ENV @@ -161,6 +173,12 @@ rwx_shell_exit() { # ╰───────┴──────╯ rwx_shell_main() { + # set current shell interactive mode + case "${-}" in + *"i"*) rwx_shell_interactive=1 ;; + *) ;; + esac + # configure shell rwx_shell_configure }