set命令简介
来源:互联网 发布:java 静态变量 泛型 编辑:程序博客网 时间:2024/04/30 18:05
set命令参数:
在脚本文件中加入了命令set –x ,那么在set命令之后执行的每一条命令以及加载命令行中的任何参数都会显示出来,每一行都会加上加号(+),提示它是跟踪输出的标识,在子shell中执行的shell跟踪命令会加2个叫号(++)。
1: [root@centos6 shell]# cat set-x.sh
2: #!/bin/bash
3: #set -x
4: echo -n "Can you write device drivers?"5: read answer
6: answer=$(echo $answer | tr [a-z] [A-Z])
7: if [ $answer = Y ]8: then
9: echo "Wow,you must be very skilled"10: else11: echo "Neither can I,I am just an example shell script"12: fi
13: [root@centos6 shell]# sh set-x.sh
14: Can you write device drivers?y
15: Wow,you must be very skilled
16: [root@centos6 shell]# sh set-x.sh
17: Can you write device drivers?n
18: Neither can I,I am just an example shell script
19: [root@centos6 shell]#
1: [root@centos6 shell]# sh set-x.sh
2: + echo -n 'Can you write device drivers?'
3: Can you write device drivers?+ read answer
4: y
5: ++ echo y
6: ++ tr '[a-z]' '[A-Z]'
7: + answer=Y
8: + '[' Y = Y ']'
9: + echo 'Wow,you must be very skilled'
10: Wow,you must be very skilled
11: [root@centos6 shell]# sh set-x.sh
12: + echo -n 'Can you write device drivers?'
13: Can you write device drivers?+ read answer
14: n
15: ++ echo n
16: ++ tr '[a-z]' '[A-Z]'
17: + answer=N
18: + '[' N = Y ']'
19: + echo 'Neither can I,I am just an example shell script'
20: Neither can I,I am just an example shell script
21: [root@centos6 shell]#
参考:http://world77.blog.51cto.com/414605/859129
http://www.runoob.com/linux/linux-comm-set.html
0 0
- set命令简介
- windows的set命令使用简介
- windows的set命令使用简介
- set命令
- set命令
- set命令
- set命令
- Level Set方法简介
- set常用操作简介
- 命令手册:Linux set命令
- SET命令--环境变量设置
- set命令详解
- 批处理set命令注意事项
- SET命令的用法
- Oracle set 命令
- vi set命令集
- set命令详解
- SET命令参数详解
- ubuntu环境安装php7+ngnix+mysql
- linux下创建mysql用户
- Java中的反射和类装载器
- 命令行运行Unity脚本
- libCEF总结02字符串
- set命令简介
- EditText末尾添加删除小圆圈一键清空
- 薪酬模块生成工资条
- 并发网络架构
- Java读取Excel内容
- matlab 2015b compile java package 编译 jre1.8 jre1.7版本不一致的问题
- 使用Spring + Jedis集成Redis
- c语言课程设计2
- contains的错误用法产生的模糊匹配bug