[clug] Use 'fc' to fix commands

Hal Ashburner hal at ashburner.info
Wed Feb 19 01:36:04 MST 2014


Happier bashing now. Thanks!
On 19/02/2014 7:32 pm, "Brendan Jurd" <direvus at gmail.com> wrote:

> 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
> a for loop, and when you hit Enter you find out that, you should have
> double-quoted a variable, say, or escaped a space.  You can do `fc` to
> open your recently fouled-up command in the $EDITOR of your choice.
> When you save and exit, the now (hopefully) working command will be
> executed.  If not, well you can just `fc` again until you get it
> right.
>
> In case the command you want to fix wasn't the most recently executed
> one (after you screwed up the command you looked up a man page for
> help and now you know what to do), `fc -l` will give a list of
> recently executed commands and you can then `fc <id>` to fix it.
>
> Happy bashing,
> BJ
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
>


More information about the linux mailing list