Get the App
SLTechnology News&Howtos  ›  Servers  › 

The difference between $() and $of linux

Shulou Source: shulou.com Published: 2022-06-03 06:27:13 09月21日 Update

What is the difference between $and $? This problem may be encountered in our daily work. Through this question, I hope you can harvest more. If you don't look at the answer, don't know if you can answer this question with confidence? Let's try it.

Linux $() $Difference

$

The symbol for $is in different places, and the definition it represents will vary. For example, in bash, the $symbol indicates that the current user is a normal user; in bash scripts.$ Start with a variable.

For example, here are some special variables:

$indicates the number of parameters

$0 is the name of the script itself

$1 is the first parameter passed to the shell script

$2 is the second argument passed to the shell script

$@ means all parameters, and all parameters are independent

$is the current process ID number of the running script

That $is the exit status showing the final command, 0 means no errors, and the other means errors.

$()

$(): This parenthesis contains the command, which acts the same as `` backquotes. Execute this command

For example, the function of $(command) is to execute the command and output the result (of course, this output is not on the screen, but in the specific context).

After reading the appeal content, do you roughly understand the difference between $() and $? If you want to know more about related articles, welcome to pay attention to the industry information channel, thank you for reading!

Tags: Parameters scripts commands questions differences content variables more users symbols errors output normal special representative function function name place screen Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei Linux Microsoft NVidia