Re: OT: User-friendly /bin/sh

2020-07-31 Thread Ottavio Caruso
On Fri, 31 Jul 2020 at 19:58, Bob Bernstein  wrote:
>
> *** Mandatory Trigger Warning /begin ***
> Brain-dead noobie post dead ahead!
> *** Mandatory Trigger Warning /end ***
>
> I have learned the hard way not to mess with the shell superuser
> is supposed to use. I rarely go to su, but it would be pleasing
> if, when I do, I had two features available from the shell:
> filename completion, and some sort of command history and
> recall.
>
> Can some Good Samaritan please point me to a HOW-TO that would
> provide the needed basic instructions?

You want ksh, both as user and as root.

This is my .shrc as standard user but you can use it and adapt it to root:


# $NetBSD: dot.shrc,v 1.3 2007/11/24 11:14:42 pavel Exp $

if [ -f /etc/shrc ]; then
. /etc/shrc
fi

case "$-" in *i*)
# interactive mode settings go here
;;
esac

# if running ksh
if [ -n "$KSH_VERSION" ]; then
# include .kshrc if it exists
if [ -f "$HOME/.kshrc" ]; then
. "$HOME/.kshrc"
fi
fi




And my .kshrc :


export HISTFILE=$HOME/.ksh.history
export HISTSIZE=1000
PS1='$(whoami)@$(hostname):$PWD$ '
export PAGER="less"
export LESS="-i -m +Gg"
export TERM=xterm



-- 
Ottavio Caruso


Re: OT: User-friendly /bin/sh

2020-07-31 Thread Bob Bernstein

On Fri, 31 Jul 2020, Bob Bernstein wrote:

Can some Good Samaritan please point me to a 
HOW-TO that would provide the needed basic 
instructions?


Thank you all!

And, yes, Mike gets two extra Fig-Newtons on his plate tonight!

--
Man is essentially a dreamer, wakened sometimes for a
moment by some peculiarly obtrusive element in the outer
world, but lapsing again quickly into the happy somnolence
of imagination.
Russell


Re: OT: User-friendly /bin/sh

2020-07-31 Thread Mike Pumford

On 31/07/2020 20:11, Jordan Geoghegan wrote:
>> Can some Good Samaritan please point me to a HOW-TO that would provide
>> the needed basic instructions?
>>
>> Thank you.
>>
>
set -E
Enable emacs style command line editing. There is a Vi style one as well.

set -o tabcomplete
Turn on tab completion for filenames.

With both of these set sh has file completion, history and editing.

All found through judicious searching of the output of man sh. ;)

Only slightly counterintuitive bit is that set -o tabcomplete turns it 
on and set +o tabcomplete turns it off.


Running set -o with no additional arguments displays the options that 
can be set.


Mike


Re: OT: User-friendly /bin/sh

2020-07-31 Thread Greg Troxel

1)

$ su
# exec my-favorite-shell

2)

read the /bin/sh man page and figure out how to turn them on.  you did
read that before posting, right?

3)

learn how to use sudo




signature.asc
Description: PGP signature


Re: OT: User-friendly /bin/sh

2020-07-31 Thread Jordan Geoghegan




On 2020-07-31 11:58, Bob Bernstein wrote:

*** Mandatory Trigger Warning /begin ***
Brain-dead noobie post dead ahead!
*** Mandatory Trigger Warning /end ***

I have learned the hard way not to mess with the shell superuser is 
supposed to use. I rarely go to su, but it would be pleasing if, when 
I do, I had two features available from the shell: filename 
completion, and some sort of command history and recall.


Can some Good Samaritan please point me to a HOW-TO that would provide 
the needed basic instructions?


Thank you.



You shouldn't need to use su, as sudo and doas are available in the 
package repository/ports tree. If you really want to run a different 
shell as the root user when you use su, you can just call the shell you 
want to use:


$ su
# zsh
%

Regards,

Jordan


OT: User-friendly /bin/sh

2020-07-31 Thread Bob Bernstein

*** Mandatory Trigger Warning /begin ***
Brain-dead noobie post dead ahead!
*** Mandatory Trigger Warning /end ***

I have learned the hard way not to mess with the shell superuser 
is supposed to use. I rarely go to su, but it would be pleasing 
if, when I do, I had two features available from the shell: 
filename completion, and some sort of command history and 
recall.


Can some Good Samaritan please point me to a HOW-TO that would 
provide the needed basic instructions?


Thank you.

--
Man is essentially a dreamer, wakened sometimes for a
moment by some peculiarly obtrusive element in the outer
world, but lapsing again quickly into the happy somnolence
of imagination.
Russell