Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The difference between $() and $of linux

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report