Linux shell的while循环
while循环
#!/bin/bash #其中“:”表示while循环的条件永远为真的意思
while :
do
read -p "Enter a number [1-5]: " num
case $num in
1|2|3|4|5)
echo "It's OK"
;;
*)
echo "Wrong,bye-bye!"
break
esac
done
Linux shell的while循环的更多相关文章
- linux shell条件与循环举例
1. if/else 语句 语法: if condition; then commands;elif condition; then commands;else commands;fi 示例:需求:脚 ...
- Linux shell for while 循环
1.数字段形式for i in {1..10}do echo $idone 2.详细列出(字符且项数不多)for File in 1 2 3 4 5 do echo $File done ...
- [Linux] shell中for循环grep正则统计指定关键字
需求是统计某个业务的访问个数日志服务器上的目录结构是如下,搜索最近7天的指定关键字数据,并排重统计个数: drwxr-xr-x root root Nov : -- drwxr-xr-x root r ...
- linux shell 读取for循环中出现难处理的数据之单引号错误实例
原语句: #!/bin/bash for test in I don't know if this'll work do echo "work:$test" done 结果: wo ...
- linux shell的for循环语法是怎样的?
答:如下: ;i<100;i++)) do echo "i=${i}" done
- linux shell 按行循环读入文件方法
转http://blog.csdn.net/hittata/article/details/7042779 #/bin/bash printf "******************** ...
- linux shell之for循环
两种方式 第一种 for((i=1;i<10;i++)) do echo $i done 第二种 for i in {1..10} do echo $i done
- Linux Shell 量的自增
Linux Shell 中写循环时,常常要用到变量的自增,现在总结一下整型变量自增的方法.我所知道的,bash中,目前有五种方法:1. i=`expr $i + 1`;2. let i+=1;3. ( ...
- Shell中的循环语句实例
1.for循环语句实例1.1 最基本的for循环 #!/bin/bash for x in one two three four do echo number $x done 注:" ...
- Linux Shell 变量自加
转至:https://blog.csdn.net/dj0379/article/details/50946398/ declare -i iv=$svnvlet iv+=1shell中变量自增的实现方 ...
随机推荐
- 响应式开发bootstrap
响应式开发原理 就是使用媒体查询针对不同宽度的设备进行布局和样式的设置,从而适配不同设备的目的. 平时我们响应式尺寸划分 超小屏幕(手机,小于768px):设置宽度为100% 小屏幕(平板,大于等于7 ...
- 线性代数 · 矩阵 · Matlab | Cholesky 分解代码实现
(搬运外网的代码,非原创:原网址 ) (其实是专业课作业,但感觉国内博客没有合适的代码实现,所以就搬运到自己博客了) 背景 - Cholesky 分解: 若 A 为 n 阶实对称正定矩阵,则存在非奇异 ...
- Verilog Review
Agenda 目的 Verilog概述 Verilog建模 模块 模块组成 书写建议 时延 Verilog基本语法 标识符 可读性 注释 空格 数据类型 操作数 运算符 条件语句 循环语句 函数 Ve ...
- QT启动问题--找不到python36.dll-cnblog
1.报错:找不到python36.dll 2.解决 通过该查询CSDN下载相应的python36.dll放到C:\Windows\System32目录下即可 https://blog.csdn.net ...
- CSS 3D - rotate旋转90度看不到的原理 和 解决方法
原理: 旋转元素的坐标有三个 :X(向右), Y(向左) , Z(向电脑屏幕的你) 当没有位移旋转元素时,元素 Z 坐标也会同着一起旋转 ,当一个物品旋转到90度时,我们只能看到它的厚度,而d ...
- Advanced .Net Debugging 1:你必须知道的调试工具
一.简介 我曾看到过许多开发人员使用错误的工具来分析问题,更有甚者,有些人连任何工具都没有使用.他们采取的分析方法通常包括:输出更多的调试信息,或者做一些临时性的代码审查.这里的临时性是指,通过 ...
- [转帖]聊聊TPS、QPS、CPS概念和区别
https://cloud.tencent.com/developer/article/1859053 TPS 概念 TPS:是TransactionsPerSecond的缩写,也就是事务数/秒.它是 ...
- [转帖]Linux 内核的 4 大 IO 调度算法
https://cloud.tencent.com/developer/article/1615744 Linux 内核包含4个IO调度器,分别是 Noop IO scheduler.Anticipa ...
- [转帖]tiup cluster restart
https://docs.pingcap.com/zh/tidb/stable/tiup-component-cluster-restart 注意 重启过程中会有一段时间服务不可用. 语法 tiu ...
- 【转帖】淫技巧 | 如何查看已连接的wifi密码
主题使用方法:https://github.com/xitu/juejin-markdown-themes theme: juejin highlight: github 一.引言 在实际工作中,常常 ...