On Thu, 29 Oct 2015, Todd C. Miller wrote:
> On Thu, 29 Oct 2015 21:38:07 -0400, "Ted Unangst" wrote:
>
> > fc -e - | -s [-g] [old=new] [prefix]
> >
> > 1. What does fc stand for? The manual doesn't tell me.
>
> According to bash it is "fix command" though I thought it was "find
> command". Who knows?
I'm expecting tedu to track down David Korn at a conference and get him to
reveal the secret. After that, he can track down Ken Thompson and find
out what 'dd' stands for, another mystery unresolved by the manpage! HOW
CAN WE BEAR TO LIVE WITH THIS SUSPENSE?!?!?
> > 2. What's prefix?
>
> I believe that lets you edit a command other than the previous one.
> E.g.
>
> $ ls /
> ...
> $ id
> $ fc -s /=~ ls
> [listing of my home dir]
>
> So in this case "prefix" is used to match the beginning of the
> command to edit.
>
> > 3. The grouping of the operands to | appears wrong. Or at least hard to
> > decipher.
>
> We should remove "-e -" from there and mention that "-e -" is equivalent
> to "-s" in the description.
We should also fix the built-in alias 'r' to use fc -s instead of fc -e -
Diff below.
> > 4. I've read this section, and the previous one on fc [-e editor | -l [-n]]
> > about a dozen times, and I think I've at last reached the point where I can
> > say with confidence I have no idea what's going on.
>
> You obviously need to spend more time in ed.
Since fc is the basis of the history command, it may not be tedu'ed
Philip
Index: ksh.1
===================================================================
RCS file: /data/src/openbsd/src/bin/ksh/ksh.1,v
retrieving revision 1.162
diff -u -p -r1.162 ksh.1
--- ksh.1 17 Oct 2015 21:06:23 -0000 1.162
+++ ksh.1 30 Oct 2015 02:59:47 -0000
@@ -847,7 +847,7 @@ integer='typeset -i'
local='typeset'
login='exec login'
nohup='nohup '
-r='fc -e -'
+r='fc -s'
stop='kill -STOP'
type='whence -v'
.Ed
@@ -3159,7 +3159,7 @@ and
.Fl s
is identical: re-execute the selected command without invoking an editor.
This command is usually accessed with the predefined
-.Ic alias r='fc -e -' .
+.Ic alias r='fc -s' .
.Pp
.It Ic fg Op Ar job ...
Resume the specified job(s) in the foreground.
Index: main.c
===================================================================
RCS file: /data/src/openbsd/src/bin/ksh/main.c,v
retrieving revision 1.71
diff -u -p -r1.71 main.c
--- main.c 22 Oct 2015 15:37:04 -0000 1.71
+++ main.c 30 Oct 2015 02:59:55 -0000
@@ -97,7 +97,7 @@ static const char *initcoms [] = {
"integer=typeset -i",
"nohup=nohup ",
"local=typeset",
- "r=fc -e -",
+ "r=fc -s",
/* Aliases that are builtin commands in at&t */
"login=exec login",
NULL,