Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the common special symbols in bash

Shulou Source: shulou.com Published: 2022-06-02 10:32:03 10月28日 Update

This article shows you what common special symbols in bash, which are concise and easy to understand, can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Simple special characters

!: the most direct function is logical non, and the most commonly used function is the operation history command (note that this function cannot be used in shell programming). For example, *! Execute the previous command,! $refers to the last word of the previous command, and! # * * refers to the entire command executed. For more information, please refer to: bash shortcut key arrangement

The most direct function is the expression delimiter, which is commonly used in * * {} for parameter substitution * *, a comma for lowercase and two commas for all lowercase (added in bash version 4.0):

Var=FooBarecho ${var,} / the result is fooBarecho ${var,} / / the result is foobar

.: the most common function is the current directory, the useful function is to replace the source command, and other functions include any character in the regular expression

:: null command (returns 0). It is also often used as a delimiter in environment variables such as PATH. The magical function is that it can be used as a function name.

;: command separator

~: user home directory, instead of $HOME environment variable

#: comment symbol, which is also a string truncation

&: let the program be executed in the background, which can be used alone, and often cooperate with nohup to make the program separate from the current terminal.

/: folder delimiter, which represents the root directory alone, and is also a division sign

*: the most commonly used is to match wildcards, which is also the multiplication sign

\: escape or wrap

-: common functions are command short options, such as ls-ah; utility is used alone to represent the previous directory, and to replace standard input and output; it is also a minus sign

+: is often used in regular expressions to indicate at least one match, which is also a plus sign

| |: pipeline |

Match one character, or 0-1 matches in a regular expression, is also a ternary operator

..: superior directory

Tags: Commands functions parameters symbols characters commonly used common special representative delimiter directory expression previous variable file regular logic input magic content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia Shulou Technology Apple Shulou Information