You are not logged in.
Pages: 1
Greetings.
I did not find the answer on wiki, google and on the forum (maybe it exists, specify the link).
When setting up the environment for work, I found commands:
">>" write at the end of the file
example
user]# echo 'alias ls=lsd' >> .bashrc #correct input, in .bashrc new line "alias ls=lsd"
user]# echo 'alias grep='grep --color=auto'' >> .bashrc #incorrect input, in .bashrc new line "alias grep=grep --color=auto", fix - edit string by hands "alias grep='grep --color=auto' "
"!!" insert the last command entered
example
$ systemctl enable dhcpcd
Failed to enable unit: Access denied #oh no.
$ sudo !!
sudo systemctl enable dhcp #shows the line being executed.
$ #end without error.
accidentally wrote "sudo systemctl "| grep dhcp "and got the output:
[User@Pc ~]$ sudo systemctl "| grep dhcp
> #nothing happens with input. pressing enter starts a new line.
>
> ^C #ctl+c stop this.
When i press the up arrow, it displays everything entered in the form of consecutive lines.
If remove the " character from the initial line and press enter, it executes all the entered lines.
Question : where i can find all of this cool stuff (commands like >>, "|, !!, >, etc.), systematized and explained (like how to make ">>" command write symbol ' )?
Last edited by Beholded (2020-06-18 07:30:00)
Offline
Most of those (not sure about !!) are not commands.
| is called pipe , while > and >> are for redirection of input/output .
https://ryanstutorials.net/linuxtutorial/piping.php seems to give a good basic description (in my opinion).
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Online
You are looking for shell built-ins. What is available here differs from shell to shell, assuming you didn't change the default and use bash you will want to read
man bashfor the official documentation, otherwise these two guides/wikis contain a few good snippets and explanations:
https://mywiki.wooledge.org/BashGuide
https://www.tldp.org/LDP/Bash-Beginners-Guide/html/
Offline
Question : where i can find all of this cool stuff (commands like >>, "|, !!, >, etc.), systematized and explained (like how to make ">>" command write symbol ' )?
Search engines and manpages. What you are describing is 'redirection' and 'history expansion', but any 'basic linux shell usage' search should give you a good run down of them.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Here's an article I recently came across with a list of these kinds of this: https://zwischenzugs.com/2020/05/09/som … bash-tips/
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
fukawi2, none of the OPs questions are about obscurities, but rather very basic fundamentals of POSIX shells (and one bashism).
Beholded, please take some time to learn about linux/unix shells if you intend to use arch. I'd recommend starting with these:
https://ryanstutorials.net/linuxtutorial/
https://ryanstutorials.net/bash-scripting-tutorial/
For one of the cases, there's no need to assume that two characters together are a special command. The result you saw with "| was just due to the quote. The pipe was irrelevant - it just ended up being the first character in a string. The command line parser was waiting for the closing quote to finish the command.
Last edited by Trilby (2020-06-19 02:01:09)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Here's an article I recently came across with a list of these kinds of this: https://zwischenzugs.com/2020/05/09/som … bash-tips/
a little too deep, but now i have more questions...
Thank all, understand what just found Bash.
Offline
Here's an article I recently came across with a list of these kinds of this: https://zwischenzugs.com/2020/05/09/som … bash-tips/
Geepers, I've been shell programming for very many years but there are a few things in there that I have never seen before!
Offline
Geepers, I've been shell programming for very many years but there are a few things in there that I have never seen before!
fc was my favorite from that list. Never knew that before.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I never used fc, but I did use vi mode (`set -o vi`). With vi mode in BASH you can edit any command in EDITOR my just hitting 'v'. So I'd just <up>, <esc>, 'v'.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Pages: 1