Re: which shell I'm using?
On Thu, Mar 04, 2004 at 11:51:04AM +0100, Richard Lyons wrote:
> On Thursday 04 March 2004 02:02, Colin Watson wrote:
> > On Wed, Mar 03, 2004 at 08:56:49PM +0100, Ruben Porras wrote:
> > > so, echo $SHELL seems not to be reliable, how could I now which
> > > shell I am using? (Imagine you need to know in a script)?
> >
> > You should never need to know this in a script, because (correct)
> > scripts should always have #! lines at the top specifying the
> > interpreter to use.
> >
> > In practice I've never found myself needing a shell variable to let
> > me know in any other situation either; I know what my login shell
> > is, and I can use 'getent passwd | grep ^whatever-my-user-name-is'
> > to find out if
>
> I learn something new every hour! Never heard of getent before.
> (Though in this instance 'cat /etc/passwd | grep
> ^whatever-my-user-name-is' is only one character longer).
There's a useless use of cat award in there. :) Mind you, I have a
redundant grep too; this is better:
getent passwd whatever-my-user-name-is
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
Reply to: