Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou Newsgroups: comp.unix.shell Subject: Re: [ksh93] defunct 'fc' command? Date: Mon, 1 Jul 2024 17:54:18 +0200 Organization: A noiseless patient Spider Lines: 62 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 01 Jul 2024 17:54:20 +0200 (CEST) Injection-Info: dont-email.me; posting-host="3aae311a4b7fe653baf8e036cd83fc5e"; logging-data="1215084"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Fc9uMbCAKrRWzS0eC6vXQ" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:LLs0NgflpLAdQSqQce8AILqOfOE= In-Reply-To: X-Enigmail-Draft-Status: N1110 Bytes: 2868 On 01.07.2024 15:00, Geoff Clare wrote: > Janis Papanagnou wrote: > >> I noticed that 'fc' doesn't seem to work on my Limux platform (neither >> with ksh93u+ nor with ksh93u+m). Usually I use that built-in command >> only as 'fc -l' (to list the history entries), and omitting the '-l' >> should execute these commands. Alas, 'fc ' doesn't work; >> for example >> >> $ fc -l 1013 1015 >> 1013 ls X >> 1014 ls Y >> 1015 ls Z >> $ fc 1013 1015 >> 15 >> ^C >> ? >> ^Z[1] + Stopped fc 1013 1015 >> $ kill %% >> [1] + Terminated fc 1013 1015 >> >> >> Is that an issue in my environment (or on my platform), or a bug? > > It's an issue with your expectation. (Actually my [inappropriate] environment setting; see below.) > By default, fc starts an editor. > Presumably you don't have FCEDIT set, as your output shows the default > editor (ed) was used; it was ed that wrote the "15" and the "?". Argh! - Yes, you are right. I was confident that I had a sensible definition, but I see that FCEDIT=/bin/ed and it didn't appear to me that what I got was an 'ed' prompt. - Thanks! > > 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. > > This is all POSIX standard stuff. Janis