序号 | 内容 | 备注 |
if | if [[]] 推荐使用双中括号。 -------------------------- -e 用于测试文件是否存在。 -------------------------- | Linux08-shell编程之运算符_哔哩哔哩_bilibili |
add | 数字运输 `expr $a + $b` $[a+b] | |
echo -e | echo -e "\n" | |
case | echo "input number:" echo "your input is:" read num case $num in 1) echo 'you choose 1' ;; 2) echo 'you choose 2' ;; 3) echo 'you choose 2' ;; 4) echo 'you choose 2' ;; *) echo 'you did not input number 1-4' ;; esac | |
while | #!/bin/bash # 初始化计数器 # 当 count 小于等于 10 时继续循环 -------------------------- #!/bin/bash # 指定文件名 # 使用 while 循环读取文件中的每一行 -------------------------- #!/bin/bash # 初始化计数器 # 当 count 大于 10 时停止循环 -------------------------- #!/bin/bash # 提示用户输入 # 读取用户输入 -------------------------- #!/bin/bash # 初始化计数器 # 当 count 小于等于 10 时继续循环 | |
shell 编程学习笔记
于 2024-07-28 18:56:21 首次发布