[SOLVED] What's an easy way to edit a multiline bash command?

3 years ago by deepdive to c/linux

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 :)

load all comments
parasrah 7 points 3 years ago

You can use C-x C-e in bash to open the current line in $EDITOR and edit it there. Much faster than copying and pasting :)

path: 0 99841, hotness: undefined, score: 7, children: 2
deepdive 1 point 3 years ago

Thank you :) Helps alot !!

path: 0 99841 104477, hotness: undefined, score: 1, children: 0
INeedMana 1 point 3 years ago path: 0 99841 107117, hotness: undefined, score: 1, children: 0
linux
linux

@lemmy.ml

login for more options
68121
9466
5670

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

go to feed...