当前位置:网站首页>Operations in shell
Operations in shell
2022-07-25 03:35:00 【Ye 124】
1. Operation symbol
+ | Add |
- | Subtraction |
* | Multiplication |
/ | division |
% | The remainder of the division 8%10=8 |
** | chengfang echo $[2**3]=8 |
++ | Self plus one |
-- | Self subtraction one |
< | Less than |
<= | Less than equal and |
> | Greater than |
>= | Greater than equal to |
>= | be equal to |
+= | ((i=1;i<=10;i++)) ((n+=i)) Add up echo $n |
*= | j=j*i |
/= | j=j/i |
%= | j=j%i |
2. Operation instruction
①(()) ((a=2+3)) echo $a
②let let a=2+3 echo $a
③expr expr 1 + 2
④echo $[1+2]
⑤bc << EOF
1+3
EOF

Calculate retained decimal
printf '%0.2f' .3 ==== 0.30 Keep two decimal places
printf '%0.3f' .3 ====0.300 Keep three decimal places
printf '%0.4f' .3 ====0.3000 Keep four decimal places
awk ‘{n=$1+$2;print n}’ file file Add the first number and the second number in the file
echo 2 3 | awk ‘{n=$1+$2;print n}’ awk Calculate the whole number 2+3
echo 0.2 0.3 | awk ‘{n=$1+$2;print n}’ awk Calculate decimal addition

边栏推荐
- Chrome debugging skills
- C. Mark and His Unfinished Essay
- Stm32cubemx quadrature encoder
- Take a note: Oracle conditional statement
- 原创|记一次高校漏洞挖掘
- NVM installation and use
- mysql_ Create temporary table
- 301. Delete invalid brackets
- Secondary vocational network security skills competition P100 dcore (light CMS system) SQL injection
- List type to string type
猜你喜欢

Brief understanding of operational amplifier

What should testers do if they encounter a bug that is difficult to reproduce?

NVM installation and use

Modulenotfounderror: no module named 'pyemd' solution

Openlayers ol ext: Transform object, rotate, stretch, zoom in
![[kaggle] how to effectively avoid oom and the long process of alchemy](/img/d1/cf6ecdeea9aa97d0eb93aa963687a5.png)
[kaggle] how to effectively avoid oom and the long process of alchemy

Li Kou 343 integer partition dynamic programming

A 20 yuan facial cleanser sold tens of thousands in seven days. How did they do it?

基于SSH婴幼儿产品销售系统

Network security - comprehensive penetration test -cve-2018-10933-libssh maintain access
随机推荐
Network security - information hiding - use steganography to prevent sensitive data from being stolen
144. Preorder traversal of binary tree
A code takes you to draw multi format sangjimei pictures such as interactive +pdf+png
Brief understanding of operational amplifier
B. Almost Ternary Matrix
Force deduction brush question 14. Longest common prefix
mysql_ Record the executed SQL
mysql_ Create temporary table
VMware installation
Fiddler grabs packets and displays err_ TUNNEL_ CONNECTION_ FAILED
Vscode copy synchronization plug-in expansion
Direct insert sort / Hill sort
Moveit2 - 8. Motion planning API
Acwing 870. approximate number
原创 | ueditor1.4.3-asmx绕过waf
Handwriting promise
Enter an integer and a binary tree
C language_ Structure introduction
NC | progress has been made in the study of the ecological network relationship between dissolved organic carbon and microorganisms in the context of global change
Database transactions (often asked)