[clug] Use 'fc' to fix commands

rdenholm at pcug.org.au rdenholm at pcug.org.au
Wed Feb 19 16:40:45 MST 2014

> Hi cluggers,
> I only just recently stumbled across the wonderful 'fc' bash built-in
> and wanted to pass on the tip in case I'm not the only one who didn't
> know about it.
> 'fc' is for those times when you type out a long command in bash, like

Nice, not used fc before.
Same as in esc k, v in ksh/ksh93.  Also have same fc builtin.
escape k being last command ## assuming a previous export EDITOR=vi set in
environment.  Analogous to that up arrow thingy bashers use :-)
v  ## initiates a vi session.
On saving edit session the command is executed.
However I have noted that in cases of severe syntactical or quote mismatch
the ksh approach may not save all history of a loop.  Does bash behave the
same way ?
BTW, the ksh command history edit behaviour can be set in bash also with
set -o vi
For those of us who use multiple unices of variable ages setting a common
editing mode and shell helps reduce stuffups despite the shells
similarity.  Now if only bash and ksh expanded remotely quoted shell
variables on the end of a ssh pipeline the same way.  As it is, they
behave in opposite ways.

More information about the linux mailing list