bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: possible bash bug - 'history'


From: Chet Ramey
Subject: Re: possible bash bug - 'history'
Date: Fri, 09 Aug 2013 16:10:10 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

On 7/19/13 11:23 AM, Mike Fied wrote:
> Dear GNU developer/code maintainer,
> 
> Please take a second to take a look at this problem - this might or might
> not be a bug, or rather a feature is not implemented in BASH:
> I am trying to get the current or "last" command line printed as the result
> of history, or a BASH variable ( to my knowledge it does not exist )
> 
> # echo "blah_blah" ; echo "$THIS_CMD_LINE" ( or history -n0 )
> 
> 
> I can do this in ksh:
> # hist -l -n0
> ( will output the same, in this case "hist -l -n0" )

This is an interesting feature request.  Right now, -0 is treated
the same as -1 on the assumption that nobody wants to operate on the
actual fc command itself, and 0 is treated the same as -0 because that
makes sense.

It's not really a Posix issue because Posix doesn't mention 0 (only
positive and negative integers), and different shells claiming posix
compatibility do different things.  And there's internally inconsistent
behavior: fc -l -n0 and fc -l -n 0 do different things in ksh93, for
instance.

So is there enough of a need to make 0 do something different?  Or does
$BASH_COMMAND suffice? (I suspect the answer to that question is "no",
because it deals with commands rather than input lines.)

What do folks think?

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]