SHELL用法五(Case语句)
case $INPUT in Pattern1) 语句1 ;; Pattern2) 语句2 ;; esac
in ) wget -c http://nginx.org/download/nginx-1.16.0.tar.gz ;; esac
select i in redhat centos ubuntu suse(菜单名) do echo $idone
#!/bin/bash PS3="What you like most of the open source system? " select i in redhat centos ubuntu suse do echo "Your Select OS is " $i done
#!/bin/bash PS3="What you like most of the open source system? " select i in redhat centos ubuntu suse do case $i in redhat) echo "redhat linux" ;; centos) echo "centos linux" ;; ubuntu) echo "ubuntu linux";; suse) echo "suse linux" ;; *) exit esac done
find(工具) path(路径) -option(参数) -action(动作); find path -option [ -print ] [ -exec -ok command ]
find / -name eth0find / -name ifcfg-eth0 find / -name "*eth0" find /etc/ -name "*eth0" find /etc/sysconfig/network-scripts/ -name "*eth0"
find / -name auto_mysql_backup.sh find / -name *mysql_backup*.sh
find / -name "*.rpm" find / -name "mariadb*rpm" find / -name "*.rpm" -a -name "mariadb*" find / -name "*.rpm" -name "mariadb*" ! -name "mariadb-libs*" find / -name "*.rpm" -a -name "mariadb*" -a ! -name "mariadb-libs*
for soft in `find / -name "*.rpm" -name "mariadb*" ! -name
"mariadb-libs*"`;do cp $soft /tmp/;done
cp `find / -name "*.rpm" -name "mariadb*" ! -name "mariadb-libs*"`
/tmp/
\cp $(find / -name "*.rpm" -name "mariadb*" ! -name "mariadb-libs*")
/tmp/
find / -name "*.rpm" -name "mariadb*" ! -name "mariadb-libs*" -exec cp
{} /tmp/ \;
find / -name "*.rpm" -name "mariadb*" ! -name "mariadb-libs*"|xargs -I {}cp {} /tmp/
SHELL用法五(Case语句)的更多相关文章
- 03 shell编程之case语句与函数
本文所有内容均来自当年博主当年学习笔记,若有不足欢迎指正 Shell编程之case语句与函数 学习目标: 掌握case语句编程 掌握shell函数的使用 目录结构: Case语句 Case语句的作用 ...
- [shell]流程控制----case语句
Shell case语句为多选择语句.可以用case语句匹配一个值与一个模式,如果匹配成功,执行相匹配的命令.case语句格式如下: case 值 in 模式1) command1 command2 ...
- shell实战之case语句的选择提示
知识点包括:case语句,cat多行输入,break和exit的区别,wget断点续传,while中断条件写法,函数的使用方法 #!/bin/bash echo "\n1. 本机容器情况如下 ...
- Shell基本语法---case语句
case语句 格式 case 变量 in 值1 ) 执行动作1 ;; 值2 ) 执行动作2 ;; 值3 ) 执行动作3 ;; .... * ) 如果变量的值都不是以上的值,则执行此程序 ;; esac ...
- shell脚本之case语句
case ... esac 为多选择语句,与其他语言中的 switch ... case 语句类似,是一种多分枝选择结构,每个 case 分支用右圆括号开始,用两个分号 ;; 表示 break,即执行 ...
- shell中的case语句
case语法: case $arg in arg1) 语句1 ;; arg2) 语句2 ;; *) help 语句 ;; esac eg: eg:
- (二)shell中case语句、程序传参、while
2.2.6.1.case语句(1)shell中的case语句和C语言中的switch case语句作用一样,格式有差异(2)shell中的case语句天生没有break,也不需要break,和C语言中 ...
- shell script 学习笔记-----if,for,while,case语句
1.if内的判断条件为逻辑运算: 2.if内的判断条件为目录是否存在,文件是否存在,下图先检验目录/home/monster是否存在,然后再检测/home/monster中的file.txt文件是否存 ...
- shell的case语句简述(shell的流控制)
shell流控制:http://www.cnblogs.com/yunjiaofeifei/archive/2012/06/12/2546208.html 1.if then else 语句 if t ...
随机推荐
- 洛谷 P1731 [NOI1999]生日蛋糕 && POJ 1190 生日蛋糕
题目传送门(洛谷) OR 题目传送门(POJ) 解题思路: 一道搜索题,暴力思路比较容易想出来,但是这道题不剪枝肯定会TLE.所以这道题难点在于如何剪枝. 1.如果当前状态答案已经比我们以前某个状态 ...
- 分块&莫队模板
最裸的莫队:https://www.luogu.org/problemnew/show/P1494 #include<bits/stdc++.h> #define ll long long ...
- Ubuntu编译protobuf
个人博客地址:http://www.bearoom.xyz/2019/08/24/ubunt-protobuf/ 因为编译了tensorflow C++的版本,然后提示protobuf的版本不对应引起 ...
- Mac系统的SVN客户端:Snail SVN 精简版
Mac系统的SVN客户端:Snail SVN 精简版 前言 本人在公司中,使用的是windows操作系统,svn客户端自然也就使用tortoise svn.但自从男朋友给我买了台macbook pro ...
- Log4Net 使用及组合公共类
好记性不如烂笔头,这次是由衷的感受到了! log4net 是一个很好用的日志记录工具,引用入项目中,如何查看项目内部运行情况,如何快速定位异常信息,好的日志记录能帮很大的忙: log4net 很好用, ...
- How to get AutoCAD Mtext content
#region 提取一个图层上的各类元素 [CommandMethod("BlockInLayerCAD")] public void BlockInLayerCAD() { Do ...
- 等和的分隔子集(dp)
晓萌希望将 1 到 N 的连续整数组成的集合划分成两个子集合,且保证每个集合的数字和是相等. 例如,对于 N = 3,对应的集合 1, 2, 3 能被划分成3和1,2两个子集合. 这两个子集合中元素分 ...
- 【MySQL优化】数据库结构优化
原则: 设计表结构,字段类型,最小化磁盘存储的空间,减少IO.数据库操作中最为耗时的操作就是 IO 处理,大部分数据库操作 90% 以上的时间都花在了 IO 读写上面.所以尽可能减少 IO 读写量,可 ...
- 吴裕雄--天生自然ShellX学习笔记:Shell echo命令
Shell 的 echo 指令与 PHP 的 echo 指令类似,都是用于字符串的输出.命令格式: echo string 您可以使用echo实现更复杂的输出格式控制. 1.显示普通字符串: echo ...
- Electron基础 - 如何创建模态窗体
在开发桌面端应用我们常常需要弹出一个提示窗体或者对话框,而提示窗体和对话框和普通窗体的区别是,在提示框出现时,其它窗体就被锁定了,必须要等到提示框被正确关闭时其它窗体才能“解锁”,这种类型的窗体叫做模 ...