From owner-freebsd-questions Sat Aug 28 9:44:55 1999 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 61ECE1530C for ; Sat, 28 Aug 1999 09:44:42 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from lithium.scientia.demon.co.uk ([192.168.0.3] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.032 #1) id 11Kjss-0008Qa-00; Sat, 28 Aug 1999 15:55:10 +0100 Received: (from ben) by lithium.scientia.demon.co.uk (Exim 3.032 #1) id 11Kjsr-0007YY-00; Sat, 28 Aug 1999 15:55:09 +0100 Date: Sat, 28 Aug 1999 15:55:08 +0100 From: Ben Smithurst To: big-sky@altavista.net Cc: freebsd-questions@freebsd.org Subject: Re: roots shell Message-ID: <19990828155508.C28779@lithium.scientia.demon.co.uk> References: <19990819222133.B12658@lithium.scientia.demon.co.uk> <000301bef156$a12cc5a0$0201010a@cmr.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: <000301bef156$a12cc5a0$0201010a@cmr.net> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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