Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 1999 01:21:06 +0000
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        "Richard E. Hawkins Esq." <rhawkins@iastate.edu>
Cc:        Pat Lynch <lynch@rush.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: csh or bash (newbie)
Message-ID:  <19990225012106.A17286@scientia.demon.co.uk>
In-Reply-To: <m10FmvT-000P4nC@eyry.econ.iastate.edu>
References:  <Pine.BSF.4.05.9902241657580.16037-100000@bytor.rush.net> <m10FmvT-000P4nC@eyry.econ.iastate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990225012106.A17286>