Wednesday, May 1, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1532  / 3 Years ago, wed, june 2, 2021, 3:22:45

Is there a way of saving nano to stdout? Or an inline editor for terminal?



I mean, I would like to do things as for example, editing an interactive php script like (from terminal):



$ php <<CODE
<?php
echo "Hello World
";
?>
CODE


But that shell inline editing (using heredoc) is too precarius to my comprehension in moment.


More From » command-line

 Answers
7

Ctrl+x followed by Ctrl+e will open up the current line in your terminal editor (should be nano by default on Ubuntu). When you save and exit the editor, what you have written within it will be executed as if you'd typed it on the command-line as normal.



If you're using vi-keys on the command-line, then you can access the same thing with <esc>v.



You can also use the fc builtin to open up the text editor on the previous command.


[#26810] Thursday, June 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brellked

Total Points: 63
Total Questions: 107
Total Answers: 104

Location: Morocco
Member since Fri, May 22, 2020
4 Years ago
;