当前位置:网站首页>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

边栏推荐
- [template engine] microservice Learning Notes 6: freemaker
- Moveit2 - 6. Planning scene monitor
- Chrome process architecture
- From input URL to page presentation
- Force deduction brush question 7. Integer inversion
- Moveit2 - 7. Scenario planning ROS API
- [Flink] transform operator flatmap
- Force deduction brush question 26. Delete duplicates in the ordered array
- mysql_ Backup restore_ Specify table_ Backup table_ Restore table_ innobackup
- [Flink] rich function
猜你喜欢

04 -- two ways of writing el and data

P100 MSSQL database penetration test of secondary vocational network security skills competition

Task02 | EDA initial experience

Force button brushing question 61. rotating linked list

301. Delete invalid brackets

Import and export using poi

mysql_ Case insensitive

144. Preorder traversal of binary tree

How is the virtual DOM different from the actual DOM?

From input URL to page presentation
随机推荐
C language_ Defining structures and using variables
292. Nim game
Leetcode.745. prefix and suffix search____ Double dictionary tree + double pointer
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
How chemical enterprises choose digital service providers with dual prevention mechanism
Imeta | ggclusternet microbial network analysis and visualization nanny level tutorial
Force deduction brush question 14. Longest common prefix
A code takes you to draw multi format sangjimei pictures such as interactive +pdf+png
Task02 | EDA initial experience
C language_ Structure introduction
VMware installation
JS password combination rule - 8-16 digit combination of numbers and characters, not pure numbers and pure English
Network security - information hiding - use steganography to prevent sensitive data from being stolen
Algorithmic interview questions
[Flink] aggregation operator
Calculation method of confusion matrix
ES6 - study notes
基于SSH婴幼儿产品销售系统
Moveit2 - 10.urdf and SRDF
Common methods of array