技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

2013年4月1日 #

shell的函数

摘要: 环境:ubuntu10.10 + bash函数定义以及传参#! /bin/shtest(){ echo $1 #打印第一个参数}a='hello,world'test $a #参数必须是定义好的变量传递两个参数#! /bin/shtest(){ echo $1 #打印第一个参数 echo $2 return 127 #只能返回整数}test 'hello,world!' 'lishujun' #传递两个参数echo $? #取得函数返回值,调用完毕立即取值取得返回值#! /bin/shtest(){ echo $1 #打印第一个参数 return 阅读全文

posted @ 2013-04-01 17:13 codestyle 阅读(201) 评论(0) 推荐(0)