当前位置:网站首页>Shell programming
Shell programming
2022-07-26 06:43:00 【noravinsc】
while loop
#!/bin/bash
i=1
sum=0
while ((i <= 100))
do
((sum += i))
((i++))
done
echo "The sum is: $sum"
Reference resources :https://www.jb51.net/article/201771.htm
Number of lines read from the file
awk 'END{print NR}' test.sh
Reference resources :https://www.bilibili.com/read/cv16036091/
Read the last line of the file
tail -n 1 file.txt
Reference resources :https://www.csdn.net/tags/MtzaEgysODk5NjMtYmxvZwO0O0OO0O0O.html
Read and execute statements
cmd=$line
# Print instructions
echo $cmd
# Execution instruction
echo $cmd | sh
Reference resources :https://blog.csdn.net/u010132847/article/details/113141583
Delete last line
sed -i '$d' <file>
Reference resources :https://blog.csdn.net/sosemseo/article/details/108356945
Append a line to the file
str='gg'
sed -i '$a\'$str /opt/b.txt
Reference resources :https://blog.csdn.net/yabingshi_tech/article/details/114364672
bash Script nohup perform
nohup bash xxx.sh > xxx.log &
边栏推荐
- Gdown Access denied:Cannot retrieve the public link of the file.
- Esxi 7.0 installation supports mellanox technologies mt26448 [connectx en 10gige, PCIe 2.0 5gt/s] driver, and supports the cheapest 10GB dual fiber network card
- 排序问题:冒泡排序,选择排序,插入排序
- Valid bracket sequence of "Niuke | daily question"
- Go的map字典及约束
- 7. Reverse Integer整数反转
- Why use the static keyword when defining methods
- Torth file read vulnerability (cnvd-2020-27769)
- What is the concept and purpose of white box testing? And what are the main methods?
- mysql优化之索引及索引失效
猜你喜欢
![[C language] file operation](/img/19/5bfcbc0dc63d68f10155e16d99581c.png)
[C language] file operation

UIToolkit中显示汉字

Do you think you are a reliable test / development programmer? "Back to the pot"? Surface and reality

Valid bracket sequence of "Niuke | daily question"

【Web3 系列开发教程——创建你的第一个 NFT(4)】NFTs 可以给你带来什么

@ConstructorProperties注解理解以及其对应使用方式
![[graduation season _ advanced technology Er] farewell to yourself who has been confused for the past two years. Regroup, junior I'm coming](/img/04/3121514fcd8fcf1c939cbca7f4c67a.jpg)
[graduation season _ advanced technology Er] farewell to yourself who has been confused for the past two years. Regroup, junior I'm coming

Input the records of 5 students (each record includes student number and grade), form a record array, and then output them in order of grade from high to low The sorting method adopts selective sortin

What are the aspects of performance testing? What are the classification and testing methods?

TCP protocol -- message format, connection establishment, reliable transmission, congestion control
随机推荐
C # use log4net plug-in to output logs to files
Downloadutilse tool class without error
力扣——4. 寻找两个正序数组的中位数
JVM class loading and GC garbage collection mechanism
Tiktok web s_ v_ web_ Analysis and implementation of ID parameter generation
供应链的多目标协同决策
『牛客|每日一题』模板栈
『HarmonyOS』探索HarmonyOS应用
@Constructorproperties annotation understanding and its corresponding usage
服装行业如何实现数字化生产模式
【毕业季_进击的技术er】送别过去两年迷茫的自己。重整旗鼓,大三我来啦
[C language] file operation
曲线曲率展示
Go 的切片与数组
Can C use reflection to assign values to read-only attributes?
[untitled]
Map dictionary and constraints of go
C# 可以利用反射给只读属性赋值吗?
@ConstructorProperties注解理解以及其对应使用方式
【保姆级】包体积优化教程