Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the linux shell escape characters

Shulou Source: shulou.com Published: 2022-06-01 03:36:01 10月03日 Update

This article is to share with you what linux shell escape characters are, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

\ t

A tab that represents a horizontal

\ v

Represents a vertical tab

\ b

Indicates a backwards character

\ a

Means "warning" (buzzing or flashing)

\ 0xx

Translated into the characters represented by the ASCII code as octal 0xx

\ "

Indicates the literal meaning of quotation marks (")

1 echo "Hello" # Hello 2 echo "\" Hello\ ", he said." # "Hello", he said.

\ $

Represents the literal meaning of the dollar sign ($) (if the variable name is followed by\ $, the value of the variable will not be referenced)

1 echo "\ $variable01" # output is $variable01

\\

Indicates the literal meaning of the backslash (\)

1 echo "\" # output is\ 2 3 # however. . . 4 5 echo "\" # on the command line, this sentence will print the value of the SP2 variable and ask you to continue typing.. 6 # in the script file, this sentence will make an error.

The role of a backslash depends on whether it is self-escaping, referenced, or present in a command substitution structure or in a here document.

1 # simple escape and reference 2 echo\ z # z 3 echo\\ z #\ z 4 echo'\ z` #\ z 5 echo'\ z' #\ z 6 echo "\ z" # 7 echo "\\ z" #\ z 8 9 # command replace 10 echo `echo\ z` # z 11 echo `echo\\ z` # z 12 echo `echo\\ z` #\ z 13 echo `echo\\ z` #\ z 14 Echo `echo\ z` #\ z 15 echo `echo\ z` #\ z 16 echo `echo "\ z" `#\ z 17 echo `echo "\\ z"` #\ z 18 19 # Here document 20 cat

Tags: Escape command character variable space parameter file literal meaning face function new line work different one line three two examples information tabs Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL vpn Docker Shulou Technology