From 7010bb86026ecaa9c2cf8052570b6bcc866bf4d1 Mon Sep 17 00:00:00 2001 From: Trent Huber Date: Sat, 8 Nov 2025 04:01:18 -0500 Subject: [PATCH] Update INSTALL.md --- INSTALL.md | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index d0c8850..1fb950f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -22,7 +22,7 @@ that are executed at login and during an interactive session. For sh, the login configuration file is `.profile`. ```console -# .profile +# ~.profile ENV=$HOME/.shrc export ENV @@ -34,16 +34,37 @@ THUSLOGIN=-l interactive sessions, in this case, `.shrc`. ```console -# .shrc +# ~.shrc -test -z "$EXEUNT" && echo $- | grep -q i && exec thus $THUSLOGIN +test -z "$ESCAPE" && echo $- | grep -q i && exec thus $THUSLOGIN ``` `THUSLOGIN` will be set to the `-l` flag only in the case when sh is running as a login shell. Running thus with the `-l` flag starts *it* as a login shell. Notice if sh is called from within thus, then it will run *as* thus which makes -it impossible to open sh as an interactive subshell. This is why the `EXEUNT` -environment variable is used as a guard in the command list. Defining `EXEUNT` -will make all subsequent calls to sh as an interactive shell actually open sh, -not thus. +it impossible to open sh as an interactive subshell. This is why the `ESCAPE` +environment variable is used as a guard in the command list. Defining `ESCAPE` +will make all subsequent calls to sh open sh itself as an interactive shell, not +thus. + +Since aliases take precedent over executables in the path, you could even define +an alias to sh that runs a script that runs sh after defining `ESCAPE`. + +```console +# ~.sh.sh + +#! /usr/bin/env thus + +set ESCAPE true +env sh +unset ESCAPE +``` + +And then the alias goes in the interactive config file for thus. + +```console +# ~.thusrc + +alias sh "~.sh.sh" +``` -- 2.51.0