File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change 5151
5252简单来说“Shell编程就是对一堆Linux命令的逻辑化处理”。
5353
54-
5554W3Cschool 上的一篇文章是这样介绍 Shell的,如下图所示。
5655![ 什么是 Shell?] ( https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/18-11-26/19456505.jpg )
5756
@@ -91,7 +90,7 @@ shell中 # 符号表示注释。**shell 的第一行比较特殊,一般都会
9190** Shell编程中一般分为三种变量:**
9291
93921 . ** 我们自己定义的变量(自定义变量):** 仅在当前 Shell 实例中有效,其他 Shell 启动的程序不能访问局部变量。
94- 2 . ** Linux已定义的环境变量** (环境变量, 例如:$ PATH, $ HOME 等..., 这类变量我们可以直接使用),使用 ` env ` 命令可以查看所有的环境变量,而set命令既可以查看环境变量也可以查看自定义变量。
93+ 2 . ** Linux已定义的环境变量** (环境变量, 例如:` PATH ` , ` HOME ` 等..., 这类变量我们可以直接使用),使用 ` env ` 命令可以查看所有的环境变量,而set命令既可以查看环境变量也可以查看自定义变量。
95943 . ** Shell变量** :Shell变量是由 Shell 程序设置的特殊变量。Shell 变量中有一部分是环境变量,有一部分是局部变量,这些变量保证了 Shell 的正常运行
9695
9796** 常用的环境变量:**
@@ -347,7 +346,6 @@ echo $a;
347346简单示例:
348347
349348``` shell
350-
351349#! /bin/bash
352350a=" abc" ;
353351b=" efg" ;
@@ -530,8 +528,6 @@ echo "输入的两个数字之和为 $?"
530528
531529### 带参数的函数
532530
533-
534-
535531``` shell
536532#! /bin/bash
537533funWithParam (){
@@ -544,7 +540,6 @@ funWithParam(){
544540 echo " 作为一个字符串输出所有参数 $* !"
545541}
546542funWithParam 1 2 3 4 5 6 7 8 9 34 73
547-
548543```
549544
550545输出结果:
@@ -557,5 +552,4 @@ funWithParam 1 2 3 4 5 6 7 8 9 34 73
557552第十一个参数为 73 !
558553参数总数有 11 个!
559554作为一个字符串输出所有参数 1 2 3 4 5 6 7 8 9 34 73 !
560-
561555```
You can’t perform that action at this time.
0 commit comments