[Top][All Lists]

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

Re: [PATCH] fc: trim range instead of erroring out

From: Chet Ramey
Subject: Re: [PATCH] fc: trim range instead of erroring out
Date: Wed, 12 Aug 2020 11:40:03 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 8/11/20 11:59 AM, Martijn Dekker wrote:

> This is different from every other shell, and also looks like it's contrary
> to the POSIX spec:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html#tag_20_44_05
> | When a range of commands is used, it shall not be an error to specify
> | first or last values that are not in the history list; fc shall
> | substitute the value representing the oldest or newest command in the
> | list, as appropriate. For example, if there are only ten commands in
> | the history list, numbered 1 to 10:
> |
> | fc -l
> | fc 1 99
> |
> | shall list and edit, respectively, all ten commands.

What's your opinion about what the `as appropriate' means? An out-of-range
`first' gets substituted with the first command in the history, and an out-
of-range `last' gets the last history entry? Bash does one thing, your
patch does another, but neither one does that.

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

reply via email to

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