当前位置:网站首页>Shell Scripts相关
Shell Scripts相关
2022-07-27 07:43:00 【nginx】
- 获得变量长度
length = ${#var} - 识别root用户
#!/bin/bash
if [ $UID -ne 0 ]; then
echo "I'm not root"
else
echo "I'm root!"
fi - 数学运算
n1=4;
n2=5;
let result=n1+n2
echo $result
let不支持小数
bc用于数学计算的高级工具。
echo "sqrt(1.44)" | bc
echo "10^2" | bc
[email protected]:~/shellscripts$ echo "sqrt(1.44)" | bc
1.20
[email protected]:~/shellscripts$ echo "10^2" | bc
100
[email protected]:~/shellscripts$ echo "10^4" | bc
10000
边栏推荐
- Regular and sed exercises
- Panabit SNMP配置
- Installation and use of apifox
- Understanding and learning of node flow and processing flow in io
- 【QT】capture. Obj:-1: error: lnk2019: unresolved external symbols__ imp_ Htons (solution)
- Record a pit dug by yourself~
- C语言:随机生成数+插入排序
- 抽象工厂模式
- Showdoc vulnerability learning - cnvd-2020-26585 (arbitrary file upload)
- Jjwt generate token
猜你喜欢

Okaleido ecological core equity Oka, all in fusion mining mode

DASCTF2022.07赋能赛密码wp

单片机多级菜单

Understanding and learning of node flow and processing flow in io

Am I delayed by the code... Unfortunately, I became a programmer

杂谈:把肉都烂在锅里就是保障学生权益了?
![[resolved] the new version of pychart (2022) connects to the server to upload files and reports an error of](/img/13/573d8ae55eb25580a5628b469dfab3.png)
[resolved] the new version of pychart (2022) connects to the server to upload files and reports an error of "command Rsync is not found in path", and the files cannot be synchronized

C# 中的转译字符'/b'

Prior Attention Enhanced Convolutional Neural Network Based Automatic Segmentation of Organs at Risk

浅谈数据安全
随机推荐
Debug:与泛型有关的“无法解析的外部符号”
正则 和 sed 练习
C common function integration-3
单片机多级菜单
[QT] unable to open the containing file pcap.h (C1083) in QT creator
记录一个自己挖的坑~
shell企业面试题练习
shell awk相关练习
【Day42 文献精读】A Bayesian Model of Perceived Head-Centered Velocity during Smooth Pursuit Eye Movement
小程序消息推送配置 Token校验失败,请检查确认
What other methods are available for MySQL index analysis besides explain
glGetUniformLocation,glUniform4f
ChromeDriver下载-自用
ARP广播实践案例
Do me a favor ~ don't pay attention, don't log in, a questionnaire in less than a minute
Grayog log server single node deployment
Abstract factory pattern
Codeforces Round #810 (Div.2) A-C
自动化测试的使用场景
What is the real HTAP? (2) Challenge article