[SunHELP] bash for root

DAUBIGNE Sebastien - BOR ( SDaubigne@bordeaux-bersol.sema.slb.com ) SDaubigne at bordeaux-bersol.sema.slb.com
Tue Mar 25 07:35:52 CST 2003


Here is a small script that, included at the end of root's .profile, will
launch ksh if and only if it's a login and interactive shell :

# "tty" to make sure we've got a terminal
# "-x /usr/bin/ksh" to make sure ksh is available (in case /usr is not
mounted)
# "ps" to verify we're in a login and interactive shell (in that case, cmd
is "-sh")
# In all other cases (background shell, cmd launched via su, etc.) it does
nothing and stays in "sh"
tty -s && [ "`ps -o args -p $$ | tail -1`" = "-sh" ] && [ -x /usr/bin/ksh ]
&& exec /usr/bin/ksh -o vi

Thus you keep statically linked "sh" as root's shell and get the advantages
of ksh or whichever shell you want.

It's a shame that in 2003 Sun doesn't give up with native Bourne Shell as
root's native shell.
HP-UX and AIX have Posix Shell (ksh), Linux has bash for years now.
---
Sebastien DAUBIGNE
sdaubigne at bordeaux-bersol.sema.slb.com
<mailto:sdaubigne at bordeaux-bersol.sema.slb.com>  - (+33)5.57.26.56.36
SchlumbergerSema - SGS/DWH/Pessac

	-----Message d'origine-----
	De:	Jim Pennino [SMTP:jimp at specsol.com]
	Date:	mardi 25 mars 2003 05:27
	@:	sunhelp at sunhelp.org
	Objet:	Re: [SunHELP] bash for root

	On Mon, Mar 24, 2003 at 10:51:30PM -0500, Bob Ababurko wrote:
	> Is is alright for root to use bash.  IF so, would I use /bin/bash?
I am
	> mostly interested in the command finishing <tab> feature so what
would my
	> alternative be?
	>
	> thanks
	> _______________________________________________
	> SunHELP maillist  -  SunHELP at sunhelp.org
	> http://www.sunhelp.org/mailman/listinfo/sunhelp

	Oh gawd, this debate goes on forever.

	A groups.google.com search on "alternative shell root" shows 13,300
hits.

	The absolutely safe answer is, if you insist on using a shell other
than
	your system's default as root, type "shell-name" as soon as you log
in
	and leave the system files alone. OK, so you have to type "exit"
twice
	to log out but you are guaranteed nothing will break this way.

	If you use this technique, use whatever shell you like.

	The other common answer is you shouldn't be mucking around logged in
as
	root in the first place.


http://groups.google.com/groups?as_q=alternative%20shell%20root&safe=images&
ie=UTF-8&oe=UTF-8&lr=&hl=en

	(All one line) if you want to spend a lot of time seeing what others
have
	said.

	--
	Jim Pennino
	_______________________________________________
	SunHELP maillist  -  SunHELP at sunhelp.org
	http://www.sunhelp.org/mailman/listinfo/sunhelp


More information about the SunHELP mailing list