Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16746

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: [PATCH] fc: trim range instead of erroring out
Date 2020-08-12 11:40 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.1739.1597246814.2739.bug-bash@gnu.org> (permalink)
References <bee8013d-39e9-7433-934f-89fce4134369@inlv.org> <b86c684a-64fc-e622-f5b0-16d382a1a27b@case.edu>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: [PATCH] fc: trim range instead of erroring out Chet Ramey <chet.ramey@case.edu> - 2020-08-12 11:40 -0400

csiph-web