From owner-freebsd-questions Wed Feb 24 23:45:39 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 33F3614CAA for ; Wed, 24 Feb 1999 23:45:36 -0800 (PST) (envelope-from ben@scientia.demon.co.uk) Received: from scientia.demon.co.uk (ident=ben) by scientia.demon.co.uk with local (Exim 2.12 #12) id 10FpUA-0004VB-00; Thu, 25 Feb 1999 01:21:06 +0000 (envelope-from ben@scientia.demon.co.uk) Date: Thu, 25 Feb 1999 01:21:06 +0000 From: Ben Smithurst To: "Richard E. Hawkins Esq." Cc: Pat Lynch , freebsd-questions@FreeBSD.ORG Subject: Re: csh or bash (newbie) Message-ID: <19990225012106.A17286@scientia.demon.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Richard E. Hawkins Esq. wrote: > I've been toying with a script to check, but I'm not quite sure how. > > I would like a .file that, on starting interactively, checks to see > if bash is available, and then executes it, otherwise staying in sh You could try something like: if [ -e /usr/local/bin/bash ] && /usr/local/bin/bash --help >/dev/null 2>&1 then exec /usr/local/bin/bash fi That condition should only succeed if you're able to execute it, and can therefore use it as an interactive shell. (And you might like to make sure it doesn't get into some sort of infinite loop where it keeps execing bash as well. It shouldn't, if you put that in .cshrc, since bash doesn't read that, but...) -- Ben Smithurst ben@scientia.demon.co.uk send a blank message to ben+pgp@scientia.demon.co.uk for PGP key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message