linux shell ` $()

 

Test example

root@ubuntu :~# cat a
123
root@ubuntu :~# echo cat a
cat a
root@ubuntu :~# echo 'cat a' #Single quotes cause
cat a
root@ubuntu :~# echo `cat a` #Reverse Quote ` causes
123
root@ubuntu :~# echo $(cat a) #$() wraps
123

  
  Note
  1. The symbol ` is not a single quote, it is the key below Esc in the upper left corner of the keyboard, which is called a backquote.
  2. The execution result of the command enclosed by the anti-symbol ` can be assigned to a variable, such as a = `cat a.txt`.
  3. `` has the same function as $(), but different shell interpreters have different support for the two commands.

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326933786&siteId=291194637