Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Dec 2013 15:55:22 +0100
From:      rank1seeker@gmail.com
To:        hackers@freebsd.org
Subject:   Re: Interactive /bin/sh
Message-ID:  <20131216.145522.249.2@DOMY-PC>
In-Reply-To: <20131216092252.784cd34edde5f4299f9dac4b@yamagi.org>
References:  <20131215.105840.948.1@DOMY-PC> <20131216092252.784cd34edde5f4299f9dac4b@yamagi.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> An alternate viewpoint:  I would prefer that /bin/sh remain as lean =
and=0D=0A> mean as possible, conforming to posix and especially NOT =
becoming=0D=0A> bloated with interactive usability stuff.  If you want a =
user-friendly=0D=0A> bourne shell and can afford the memory and cycle =
bloat, use bash. =0D=0A>=0D=0A> Please keep /bin/sh lightweight for =
embedded and dedicated-purpose=0D=0A> systems that need a =
posix-conforming shell without a ton of overhead.=0D=0A=0D=0AI'm against =
code-bloat. We are talking here about minimalistic interactive shell, =
which is compatible with base scripts.=0D=0AScripting in [t]csh and just =
.cshrc, is a hell (and it basically aliases to 'sh' scripts which =
actually do the real work). I use it only because of =
interactivnes.=0D=0AI don't have many interactive needs and sh is just =
metting those.=0D=0A=0D=0ANow, BEFORE any code is added, let see what do =
we have available ATM 9.2 RELEASE...=0D=0A=0D=0Apath completion =3D> =
function which provides it, searches CURRENT dir=0D=0ASo, in order to =
implement command completion, we need to use SAME EXISTING function of =
path completion, in EACH dir specified in PATH variable=0D=0A+ once this =
has been done, results can be buffered, as PATH's dir are static (upon =
port install, one would 'rehash' which would need =
implementation)=0D=0A=0D=0AThere is even more useful EXITING but =
UNDOCUMENTED =
code:=0D=0Ahttp://svnweb.freebsd.org/base/head/bin/sh/parser.c?view=3Dmarkup=0D=0A=0D=0AI =
wanted current dir, to dinamically change in prompt whenever I 'cd' =
somwhere:=0D=0A--=0D=0APS1=3D$PWD    # Won't work as it is =
static!=0D=0A--=0D=0A=0D=0AAt above URL, looking at lines 1939-2002 where =
'switch' resides:=0D=0A--=0D=0A# \h - local hostname=0D=0A# \w - working =
dir (full path)=0D=0A# \$ - becomes '$' for normal users, '#' for =
root=0D=0APS1=3D"$USER@\h:\w \$ ";  export PS1=0D=0A--=0D=0ANow I have =
dinamic current dir in prompt. (I even colorized each part of prompt, but =
coloring code here would be too long and messy)=0D=0AI would just like =
another one \something, which would give last CMD's exit code, to be part =
of a prompt.=0D=0ACost would be just 1 additional 'case' in above =
'switch' statement=0D=0A=0D=0A=0D=0A> After svn r244941 - which fixed a =
bug preventing ed-search-next-history=0D=0A> and ed-search-prev-history =
from working - this should be possible. To=0D=0A> bind them on "Page Up" =
and "Page Down":=0D=0A> - bind "\e[5~" ed-search-prev-history=0D=0A> - =
bind "\e[6~" ed-search-next-history=0D=0A=0D=0ALooks like what I wanted =
to be implemented (Prefix-based history navigation), is already here. =
;)=0D=0AIt works slightly different then in [t]csh, that is, it matches =
string anywhere in history of command, while [t]csh's implementation only =
from begening.=0D=0ABut it doesn't matter, I like it anyway. Just a few =
more key presses and occurance is narrowed enough.=0D=0A=0D=0A> But as =
far as I know, even with those bindings /bin/sh is still missing=0D=0A> a =
way to save the command history to disk and load it back at =
startup.=0D=0A=0D=0AWell, to me it isn't so important, but it can be =
emulated for login shell via custom functions that are auto called upon =
login, via ~/.profile and ~/.shrc=0D=0AUpon logout:=0D=0A    fc -ln > =
.sh_history=0D=0AHowever, I don't know how to fill it back into builtin =
'fc' at login ... :P=0D=0A=0D=0A=0D=0ATo sum up:=0D=0AJust add path =
completion with rehash & last CMD's exit code for custom =
prompt.=0D=0AHistory file, if others want.=0D=0A=0D=0A=0D=0A=0D=0ADomagoj =
Smol=E8i=E6



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131216.145522.249.2>