untouched bug in less package

Fergal Daly fergal at esatclear.ie
Sat Oct 27 22:08:50 UTC 2007

On 27/10/2007, Kristian Erik Hermansen <kristian.hermansen at gmail.com> wrote:
> On 10/27/07, "Fergal Daly" <fergal at esatclear.ie> wrote:
> > The basic problem is that lesspipe uses $SHELL to tell what the
> > current shell is, but that's wrong, it only tells you what the login
> > shell is when what you really want to know is which shell invoked
> > lesspipe.
> >
> > I'm not sure there is a way to discover what invoked you, so maybe the
> > invoker needs to pass that information, maybe set $SHELL for the eval.
> >
> > Any comments?
> I don't know if this is something close to what you want, but how about?
> $ readlink /proc/$$/exe

That tells you what shell is running the lesspipe script but you
already know that - it's /bin/sh. You need to know what shell called
the script.

/etc/skel/.bashrd does this

[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"

and lesspipe should output some bash-compatible commands to set
variables. I've fixed the problem in my own .bashrc by changing it to

[ -x /usr/bin/lesspipe ] && eval "$( SHELL=/bin/bash; lesspipe )"

which might be a satisfactory solution,


> Or replace $$ with the invoking pid of your lesspipe process...
> --
> Kristian Erik Hermansen

More information about the Ubuntu-devel-discuss mailing list