Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Want to replace bash w zsh as system shell on Ubuntu

On 2010-02-04 at 01:23 -0500, rj wrote:
> Sorry to sound all the alarms about /bin/sh (but glad to have spawned
> a discussion).  I'd never muck with /bin/sh -- 95% of all scripts reference
> it in their first line.
> On Tue 02/02/10 at 01:21 PM +0100, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> > If this whole question is about the interactive shell that you're
> > getting dropped into by `sudo' (which I suspect), I'd change root's
> > shell to zsh by chsh(1) and use `sudo -i' instead of `sudo -s'.
> This is what I did, and am doing.

As a contrasting point of view:

I don't change root's shell.  I don't put much in root's start-up.  When
I'm logging in as root, I want to be in as cleanly and simply as
possible, because I don't know what sort of state the system will be in
then.  Perhaps something's running amok and forking a new process will
add a four minute delay, for instance.  (Ah yes, triggerable memory
leaks, such fun).

The *safest* way is to leave root's shell as /bin/sh but to edit
/root/.profile (or whatever to include the line:

  alias z='exec zsh -l'

That's so simple that when I'm working interactively I can type z<enter>
without even thinking about it.

This is also a good habit to get into when working on systems where
multiple people have root.  There's no need to have arguments about
shells, etc.  Especially if you code up some logic which looks at where
you're connecting from and uses a dispatch table to let different people
have different shell configurations as root.  (Managing
deploying/maintaining those is another matter).

So in my case, there's one scenario in which I try to fork two extra
commands in root login, on console, on the basis that if fork fails,
it's not a disaster and I'm more likely to be dealing with a runaway
memory hog and anything that gets me more CPU when coming in on serial
console is likely to be a net win:

----------------------------8< cut here >8------------------------------
alias z='exec zsh -l'
alias b='exec bash --login'
if [ $TERM = vt100 ]; then
        if [ `tty` = /dev/ttyd0 ]; then
                renice -5 $$
                echo "Did: renice -5 $$"
alias n='renice -5 $$'
----------------------------8< cut here >8------------------------------

Just a thought,

Messages sorted by: Reverse Date, Date, Thread, Author