Date: Sat, 28 Aug 1999 15:55:08 +0100 From: Ben Smithurst <ben@scientia.demon.co.uk> To: big-sky@altavista.net Cc: freebsd-questions@freebsd.org Subject: Re: roots shell Message-ID: <19990828155508.C28779@lithium.scientia.demon.co.uk> In-Reply-To: <000301bef156$a12cc5a0$0201010a@cmr.net> References: <19990819222133.B12658@lithium.scientia.demon.co.uk> <000301bef156$a12cc5a0$0201010a@cmr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Mark Einreinhof wrote:
> I like your paranoia... could you explain what that line means?
Of course. All it does is run `bash --version`, throughing its output
away, which will just make sure you *can* actually run it. If that
succeeds, it will run bash properly as a login shell for you. The test
-x command just makes sure the file has the executable flag set. Normally,
that should be enough, but if you want to be paranoid you should check for
example that a library isn't missing.
allow me to demonstrate:
root@magnesium:~# bash --version
/usr/libexec/ld-elf.so.1: Shared object "libc.so.3" not found
root@magnesium:~# echo $?
1
root@magnesium:~# [ -x /usr/local/bin/bash ]
root@magnesium:~# echo $?
0
root@magnesium:~#
As you can see, the [ -x ] says that bash *can* be executed, when in
fact, it cannot, as running it demonstrates: a library is missing. If
you do exec bash when a library is missing, your current shell will
vanish, and take you back to a login prompt, or in my case, my normal
account which I had su'd from (yes, I did have another root window open
to put libc.so.3 back in place :-)
> Can I place it into the .login file as written minus quotes,
> "/usr/local/bin/bash --version >/dev/null 2>&1 && exec /usr/local/bin/bash"
Yes.
> or do I need the [ -x like the earlier line was written?
No.
--
Ben Smithurst | PGP: 0x99392F7D
ben@scientia.demon.co.uk | key available from keyservers and
| ben+pgp@scientia.demon.co.uk
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990828155508.C28779>
