Neat Bash trick: open last command for editing in default editor, then execute on save
This is pretty slick: enter "fc" in the shell and your last command opens up for editing in your default editor (as given by "$EDITOR"). Works perfectly with vi. The"$EDITOR" variable approach does not seem to work with BBEdit though, and you have to:
$ fc -e '/usr/bin/bbedit --wait'
With vi, ":cq" aborts execution of the command. Not sure how to do the same thing with BBEdit.
feed
Comments
2 comments postedFrom bash man page
edit-and-execute-command (C-xC-e)
Invoke an editor on the current command line, and execute the result as shell commands. Bash attempts to invoke
$FCEDIT, $EDITOR, and emacs as the editor, in that order.
Post new comment