Sunday, April 28, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 15204  / 2 Years ago, fri, december 10, 2021, 11:07:10

I am trying to write a script but I'm stuck here. See the code please!



aug@august:~/play$ for i in {1..100..4}
> do
> echo "august"
> touch august $i+$2
> mkdir dir


Is there any way to go previous line? I mean there was a mistype, I did in touch august $i+$2. Ipressed ENTER key, so I went for new line. How can I get back to previous line?


More From » command-line

 Answers
5

bash's command-line editor doesn't support this, either do as anwar suggests or keep everything on one line separated by semicolons or put it into a script file.



On a side note, zsh has features that help with this. The zsh line editor (zle) is a more fully featured editor and supports moving within a multi-line command. When the command becomes too long to handle in zle it has a builtin feature, edit-command-line, which opens up the command-line in your favorite editor. It's usually not bound, try with:



bindkey "^[e" edit-command-line


Alt-e should now activate it, save and quit to go back to the command-line.


[#35683] Saturday, December 11, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cugure

Total Points: 188
Total Questions: 110
Total Answers: 103

Location: Dominican Republic
Member since Sun, Sep 4, 2022
2 Years ago
;