Sujet : Re: [ksh93] defunct 'fc' command?
De : geoff (at) *nospam* clare.See-My-Signature.invalid (Geoff Clare)
Groupes : comp.unix.shellDate : 02. Jul 2024, 14:50:29
Autres entêtes
Message-ID : <ll9dlk-son.ln1@ID-313840.user.individual.net>
References : 1 2 3
User-Agent : Pan/0.154 (Izium; 517acf4)
Janis Papanagnou wrote:
On 01.07.2024 15:00, Geoff Clare wrote:
If you just want the commands executed, you can specify an editor
that does nothing:
fc -e true 1013 1015
fc -e : 1013 1015
This is a nice code pattern.
Or, if you only want to execute one command, you can use -s (without
specifying a substitution).
I had tried this before and got an inconsistent error message (-e
instead of -s) when [inappropriately] trying for a range
$ fc -s 1071 1073
ksh: fc: -e - requires single argument
so I haven't followed that path further.
Yes, you can't give a range with -s (which is why I wrote "if you only
want to execute one command" above).
Looks like ksh implements -s by pretending that "-e -" was specified,
but the output from "--help" implies the relationship is the other way
round:
OPTIONS
-e editor editor specifies the editor to use to edit the history
command. A value of - for editor is equivalent to
specifying the -s option.
It would make more sense for the code to do it that way too, since -s is
in POSIX but "-e -" isn't.
-- Geoff Clare <netnews@gclare.org.uk>