shell-函数
来源:互联网 发布:泛微oa数据库 迁移 编辑:程序博客网 时间:2024/06/06 15:01
shell脚本中,函数的语法如下:
function fname () { 程序段}
function也是拥有内置变量的,它的内置变量与shell script很类似,函数名称代表示$0
,而后续的变量也是以$1, $2...
来替代的。
一个简单的例子如下:
#!/bin/bashfunction print_message () { echo "my name is $1, and my studentnum is $2"}print_message jimmy 111000623print_message xiaohong 111000624
执行结果如下:
root@silent:/home/lianxi/shell# ./function.sh my name is jimmy, and my studentnum is 111000623my name is xiaohong, and my studentnum is 111000624
0 0
- [shell]shell函数
- shell函数
- Shell 函数
- Shell 函数
- shell函数
- shell --函数
- shell 函数
- shell函数
- shell函数
- 【shell】函数
- shell 函数
- shell---函数
- Shell 函数
- shell函数
- shell 函数
- Shell 函数
- shell函数
- Shell 函数
- Java泛型系类之一 为什么要使用泛型
- Qt下载
- Java网络请求(get/post)工具类实现的两种方式
- C/C++基本数据类型
- 测试人员检出SVN的致命error,Build failed with an excception
- shell-函数
- Step by Step,用JAVA做一个FLAPPYBIRD游戏(一)
- js 数据类型
- 读《石头剪刀布》总结与感想
- Java中ElementType源码
- VR中的9轴传感器(重力加速度/陀螺仪/磁力计).md
- Leetcode461. Hamming Distance不要太简单哦
- 最近写的一个存储过程
- 素数