Commands with lots of arguments sometimes use slash escaped newlines to make them easier to read on the web. Here is a silly example

echo -n \
"hello" \

I'm not sure how to paste and edit this "properly"

Pasted into bash you get

$ echo -n \
> "hello" \
> "world"

Now if I navigate with the back arrow key on OSX, I can only edit the line with > "world", not the first two lines. Usually I have to paste into a temp file to fix up a command.

Is there a better way to perform this paste which allows editing any line? bash setting which makes this work in a nicer way?

  • You need an editor which displays CR and LF and you will see that this is not possible since there is an <kbd>ENTER</kbd> in the paste. Put it in one line without CRLF and you won't have the problem. Nov 2, 2015 at 7:36

1 Answer 1


When you have such a command on several lines you can, if you're using bash in emacs mode (usually the default one) ctrl+x ctrl+e it will open your favorite editor, as specified in your EDITOR variable.

Or you can type fc, this will open the editor on the last command you've typed, then you can edit it as you want, then feel free to quit, and it will be executed.

  • the editor shortcut is nifty. type fc?
    – pseudo647
    Nov 2, 2015 at 10:30
  • It's opening an editor on the last command in your bash history, it's a bash built-in command Nov 2, 2015 at 10:37
  • It seems nice for some quick prototyping, but as soon as you need to fix/edit your last command, all the formatting is gone so it's a complete mess in the end. Jul 1, 2019 at 8:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .