Hello there :)
As far as I know (searched through the web), editing/navigating a multiline in bash is not possible and opening nano, pasting and editing is to much friction I want to get rid off.
Do you have any way to speed up the process?
example of multiline:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Thank you :)
15 Comments
parasrah@lemmy.parasrah.com · 7 pts · 3y
You can use
C-x C-ein bash to open the current line in$EDITORand edit it there. Much faster than copying and pasting :)INeedMana@lemmy.world · 1 pts · 3y
Wow! I've never heard about this.
For zsh: not mine gist to enable it
deepdive@lemmy.world · 1 pts · 3y
Thank you :) Helps alot !!
taaz@lemmy.world · 5 pts · 3y
Ctrl+x Ctrl+e
deepdive@lemmy.world · 1 pts · 3y
Hey :) Thank you !! That's not exactly what I hoped for but it does the trick very smoothly !!!!
gartheom@lemmy.world · 5 pts · 3y
As soon as a bash command gets to multiple lines, i save it as a bash script and then edit it in a text editor.
deepdive@lemmy.world · 1 pts · 3y
Thank you for your response :) But that's actually what I don't want to do...
3nt3r@lemmy.world · 2 pts · 3y
Personally if its just a bash command then I dont bother with formatting and just do one-liners. If I want it to look pretty then I’ll put it in a script. If I need to edit something you can use shortcuts like these to jump around the command line to edit whatever you need
deepdive@lemmy.world · 1 pts · 3y
Hey, thank you for your response :)
It's not about looking pretty, I like to navigate freely like CTRL-E, CTRL-A, ALT-B, ALT-F... speeds up the process and is frictionless (like your link suggests it :P). Sometimes I copy/past an already written command in the CLI with multilines and not being able to navigate thourgh them is frustrating !
nii236@lemmy.jtmn.dev · 2 pts · 3y
You can use the emacs shortcuts to navigate quickly, jump forward or backwards over words or to the start or end of a line.
deepdive@lemmy.world · 1 pts · 3y
Hey thank you :) I didn't knew these shortcuts where called emacs ! As @taaz said Ctrl+x Ctrl-e is probably the best I will get.
nii236@lemmy.jtmn.dev · 1 pts · 3y
These get me most of the way around.
It also depends on your terminal emulator. For instance on my Mac I've mapped the above to the typical keybinds (alt-left, alt-right, ctrl-backspace)
deepdive@lemmy.world · 1 pts · 3y
Thank you :) My question was maybe a bit confusing (not native :( ) and yes I know those EMACs shortcuts to navigate around :). It was relate to how to navigate a multiline in a copy/pasted command in the shell. The solution is (even if it wasn't what I expected) to Ctrl-x Ctrl-e, this opens an editor with my copied command. This is one more step, but it's elgant and takes away the fritction from opening nano myself !
Thank you for your contribution !
PopOfAfrica@lemmy.one · 1 pts · 3y
deepdive@lemmy.world · 2 pts · 3y
Thank you for your insight ! :)) I'm relatively new to linux (ubuntu/debian) and this will probably commin handy in the future :). As I read on the web it's going to replace the
X Window System. Something new to read through and learn !PopOfAfrica@lemmy.one · 2 pts · 3y