命令的类型:
1>.外部命令:在命令提示符中执行的普通命令。
2>.内置命令:内置命令是在shell内部实现的。

1.break命令

#!/bin/sh
rm -rf fred*
echo > fred1
echo > fred2
mkdir fred3
echo > fred4 for file in fred*
do
if [ -d "$file" ]; then
break;
fi
done
echo first directory starting fred was $file
rm -rf fred*
exit

2.冒号:

1.空命令,用于被简化逻辑,相当于true的一个别名。比true运行快,可读性差。
2.用在变量的条件设置中。
  : ${var:=value}
    如果没有:shell将试图把$var当做一条命令处理

#!/bin/sh
rm -f fred
if [ -f fred ]; then
:
else
echo file fred did not exist
fi
exit

3.continue命令

#!/bin/sh

rm -rf fred*
echo > fred1
echo > fred2
mkdir fred3
echo > fred4 for file in fred*
do
if [ -d "$file" ]; then
echo "skipping directory $file"
continue
fi
done rm -rf fred*
exit

shell学习笔记之命令(四)的更多相关文章

  1. linux shell 学习笔记--内部命令学习

    .基本命令 新手必须要掌握的初级命令 ls 基本的列出所有文件的命令.但是往往就是因为这个命令太简单,所以我们总是低估它.比如 ,用 -R 选项,这是递归选项,ls 将会以目录树的形式列出所有文件, ...

  2. [Shell学习笔记] read命令从键盘或文件中获取标准输入(转载)

    转自:http://www.1987.name/151.html read命令是用于从终端或者文件中读取输入的内部命令,read命令读取整行输入,每行末尾的换行符不被读入.在read命令后面,如果没有 ...

  3. shell学习笔记

    shell学习笔记 .查看/etc/shells,看看有几个可用的Shell . 曾经用过的命令存在.bash_history中,但是~/.bash_history记录的是前一次登录前记录的所有指令, ...

  4. [转帖][Bash Shell] Shell学习笔记

    [Bash Shell] Shell学习笔记 http://www.cnblogs.com/maybe2030/p/5022595.html  阅读目录 编译型语言 解释型语言 5.1 作为可执行程序 ...

  5. python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法

    python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法window安装redis,下载Redis的压缩包https://git ...

  6. shell学习笔记汇总

    1.shell脚本中函数使用 函数定义在前,调用在后,顺序反了就没有效果了.函数调用为:函数名 参数列表 函数内部通过以下变量访问函数的参数:shell脚本函数中: $0: 这个脚本的名字 $n: 这 ...

  7. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化 学习目标 对Direct 3D编程在 ...

  8. SHELL学习笔记三

    SHELL学习笔记一 SHELL学习笔记二 SHELL学习笔记三 for 命令 读取列表中的复杂值 从变量读取列表 从命令读取值 更改字段分隔符 用通配符读取目录 which 使用多个测试命令 unt ...

  9. 【Unity Shaders】学习笔记——SurfaceShader(四)用纹理改善漫反射

    [Unity Shaders]学习笔记——SurfaceShader(四)用纹理改善漫反射 转载请注明出处:http://www.cnblogs.com/-867259206/p/5603368.ht ...

随机推荐

  1. WCF 自承载 提供源码

    一.WCF 简单介绍 Windows Communication Foundation(WCF)是由微软发展的一组数据通信的应用程序开发接口,是一套通讯接口.现在比较流行的SOA就可以通过WCF实现. ...

  2. windows环境按照dcm4chee

    背景: dcm4chee是dcm4che开源项目中的一部分,是一款符合IHE规定的影像管理/归档应用.dcm4chee遵循DICOM.HL7标准,实现了图像存储.图像提取.及健康领域的工作流程管理.d ...

  3. csm pssm +pcf pcss sdsm

    这几个shadow算法 pcf是sample时候用的 按照一个mode采样几个位置 根据采样结果 决定0-1  可以是0.234 这样就不是 0或者1 就是soft了 主要讲下pcss 是啥 因为我之 ...

  4. C# 动态装载 DLL

    C# 动态装载 DLL LoadDllTool.cs 如下: using System; using System.Collections.Generic; using System.Text; us ...

  5. [ACM] POJ 2524 Ubiquitous Religions (并查集)

    Ubiquitous Religions Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 23093   Accepted:  ...

  6. [Firebase] 4. Firebase Object related Database

    The idea: This post we are going to learn how to build a Firebase Forage with object related databas ...

  7. HDU2089 ------不要62(数位dp)

    不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  8. centos下docker网络桥接

    停止服务 停止docker0网卡 Ip link set dev docker0 down 删除docker0 Brctl delbr docker0 进入到网卡的配置文件创建桥接网络br0 Brct ...

  9. How to change in the Cocos2d-x project from landscape to portrait both in iOS and Android

    iOS: This is done using XCode project details (select the required orientation) Android: AndroidMani ...

  10. activeMQ消费消息时网络流量异常大的问题

    http://www.cnblogs.com/baibaluo/archive/2012/12/24/2748468.html#2590289 公司有一个应用,多个线程从activeMQ中取消息,随着 ...