Linux bash fi
Linux bash fi

if..else..fi allows to make choice based on the success or failure of a command.
if..else..fi 允许根据命令的成功或失败进行选择。
if [ conditional expression ]
then
statement1
statement2
.
fi
if [ expression ]
then
Statement(s) to be executed if expression is true
fi
demo
if [ ! -x /usr/bin/axel ]
then echo "axel is not installed, perform this?(y/n)"
read ops
case $ops in
y) if apt-get install axel -y --force-yes
then echo "axel installed"
else echo "unable to install the axel. you are using sudo?" ; exit
fi ;;
n) echo "not possible usage apt-fast" ; exit ;;
esac
fi
https://stackoverflow.com/questions/7010830/bash-whats-the-use-of-fi
refs
https://bash.cyberciti.biz/guide/If..else..fi
https://www.tutorialspoint.com/unix/if-fi-statement.htm
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
Linux bash fi的更多相关文章
- linux bash关闭标准输出1(exec 1<&-)后重新打开
linux bash shell的再次学习. 文件描述符: stdin,stdout 和 stderr 的文件描述符分别是 0,1 和 2(一个文件描述符说白了就是文件系统为了跟踪这个打开的文件而分配 ...
- 【转】Linux(BASH)命令搜索机制
原文网址:http://www.mike.org.cn/articles/linux-linux-bash-command-search-mechanism/ 转自:Eric Cheung: Linu ...
- Linux Bash编程
在Linux系统介绍中,介绍了shell的多个版本,现在的Linux发行版基本都默认使用bash(Bourne Again shell),兼容Bourne shell (sh),本文将简要介绍Bash ...
- Linux Bash命令杂记(tr col join paste expand)
Linux Bash命令杂记(tr col join paste expand) tr命令 tr命令可以将输入的数据中的某些字符做替换或者是作删除 tr [-ds] STR d: 删除输入数据的中的S ...
- 转: windows 10使用原生linux bash命令行
转: https://www.zybuluo.com/pandait/note/337430 windows 10使用原生linux bash命令行 linux bash windows-10 第一时 ...
- Linux Bash代码 利用for循环实现命令的多次执行
Linux Bash代码 [yuanhao15@lu01 libsvm-rank-2.81]$ for ((i=0; i<=19; i++)) do ./svm-train -s 5 -c 10 ...
- linux BASH shell设置字体与背景颜色
linux BASH shell下设置字体及背景颜色的方法. BASH shell下设置字体及背景颜色 echo -e "\e[31mtest\e[41m" \e[30m 将字 ...
- Linux:-bash: ***: command not found
Linux:-bash: ***: command not found,系统很多命令都用不了,均提示没有此命令. 突然之间linux很多命令都用不了,均提示没有此命令. 这应该是系统环境变量出现了问题 ...
- Linux Bash命令关于程序调试详解
转载:http://os.51cto.com/art/201006/207230.htm 参考:<Linux shell 脚本攻略>Page22-23 Linux bash程序在程序员的使 ...
随机推荐
- linux总线
编写驱动程序: 1 #include <linux/init.h> 2 #include <linux/module.h> 3 #include <linux/devic ...
- Scrapy——將數據保存到MySQL數據庫
Scrapy--將數據保存到MySQL數據庫 1. 在MySQL中創建數據庫表job_inf: 1 Create table job_inf( 2 id int(11) not null auto_i ...
- ryu—流量监视
1. 代码解析 ryu/app/simple_monitor_13.py: from operator import attrgetter from ryu.app import simple_swi ...
- 安装sqlserver 的时候 报错:无法通过Windows功能控制面板自动安装或卸载Windows Server 角色和功能。
无法安装以下功能:.NET Framework 3.5(包括.NET2.0和3.0) 无法通过Windows功能控制面板自动安装或卸载Windows Server 角色和功能. 若要安装Windows ...
- LOJ10090
题目描述 原题来自:USACO 2005 Dec. Gold FJ 有 n 头奶牛(2<=n<=1000) ,编号为1..n .奶牛们将按照编号顺序排成一列队伍(可能有多头奶牛在同一位置上 ...
- 济南学习D1T1_haha
[问题描述] 栈是一种强大的数据结构,它的一种特殊功能是对数组进行排序.例如,借助一个栈,依次将数组1,3,2按顺序入栈或出栈,可对其从大到小排序: 1入栈:3入栈:3出栈:2入栈:2出栈:1出栈. ...
- MySQL的索引为什么用B+Tree?InnDB的数据存储文件和MyISAM的有何不同?
前言 这篇文章的题目,是我真实在面试过程中遇到的问题,某互联网众筹公司在考察面试者MySQL相关知识的第一个问题,我当时还是比较懵的,没想到这年轻人不讲武德,不按套路出牌,一般的问MySQL的相关知识 ...
- Language Guide (proto3) | proto3 语言指南(九)Oneof结构
Oneof - Oneof结构 如果消息包含多个字段,并且最多只能同时设置一个字段,则可以使用oneof功能强制执行此行为并节省内存. oneof字段与常规字段类似,但oneof共享内存中的所有字段除 ...
- jvm 总体梳理
jvm 总体梳理 1.类的加载机制 1.1什么是类的加载 1.2类的生命周期 1.3类加载器 1.4类加载机制 2.jvm内存结构 JVM内存模型 2.1jvm内存结构 2.2对象分配规则 3.GC算 ...
- js创建javaMap
/** * Simple Map * var m = new Map(); * m.put('key','value'); * var v_otherMap = v_m.toMapString();* ...