ChinaUnix.net
相关文章推荐:

shell自定义函数

[code]tester@debian:/$ tester tester: command not found tester@debian:/$ function tester { echo 'hello'; } tester@debian:/$ tester hello tester@debian:/$ [/code]测试代码如上,不知道怎么可以取消tester函数呢?就是当我输入tester时重回显示tester: command not found

by u634781 - Shell - 2010-07-02 15:23:43 阅读(1647) 回复(3)

相关讨论

问题:自定义的shell脚本函数如何传递参数? function fun1() { echo $1 hello word; return 256; } function fun2() { echo $? } function fun3() { echo $1 my parm; } fun1 $1 #把命令行传入的第一个参数传递给fun1函数; fun2 #顺序执行,fun2函数把fun1的返回值输出; fun3 $2 #把命令行第二个参数作为fun3的第一个参数; #============================== 注释: (1)shell脚本自定义函数的返回值范围[0-255]; (2...

by 寻蝉林子 - Shell - 2016-11-07 14:12:20 阅读(2701) 回复(5)

比如我在一台中控机器上写了个脚本 #! /bin/sh FUN { echo "what is you name" } ssh 1.1.1.1 " FUN" 就是在一个SSH的脚本里面如何调用这个FUN函数, 当这么执行的时候,会提示FUN:command not found 谢谢各位大侠~~!

by 本大王 - Linux新手园地 - 2012-09-26 22:08:45 阅读(6132) 回复(4)

我想在c-shell中自定义函数,不知道怎么写,请帮忙写个简单的例子看看,我知道k-shell中可以,我想知道c-shell中如何实现,帮帮忙

by sxc_soft - Shell - 2005-03-08 18:46:01 阅读(2503) 回复(2)

如题 求 办法 附上代码: #!/bin/sh db_insert() { sql="insert into testTable(id , name) values('' , '$1')"; mysql -h192.168.1.1 -P3306 -utestUser -ptestPwd -e "$sql"; } awk 'BEGIN{ FS="\t"; } { 我想在这个地方调用,函数db_insert 并代入参数 $1 db_insert } END { }' "test.txt" 只知道调用系统函数 用 system(); 不知道这个怎么调?新手请高手帮助!!

by claudeyuan - Shell - 2008-09-11 14:50:41 阅读(4095) 回复(5)

例如有shell函数: function add1() { result=`expr $1 + 1` echo $result } export -f add1 awk 'BEGIN{"add1 2"|getline result;print result }' #这里输出3,因为我传了2作为参数 但是我想要把2赋给变量,例如 p=2,再通过p作为参数传递给add1,如果调用呢?

如何

by justcx - Shell - 2015-05-03 13:25:55 阅读(5790) 回复(16)

shell中的自定义函数名要怎么起,怎么除了start ()系统不认别的?

by yelvtaohua - Shell - 2005-12-12 19:23:43 阅读(1219) 回复(1)

Mike Harrington:(510) 548-1278:250:100:175 Chrstian Dobbins:(408) 538-2358:155:90:201 Susan Dalsass:(206) 548-1348:250:60:50 Archie McNichol:(206) 654-6279:250:100:175 Jody Savage:(206) 548-1278:15:188:150 Guy Quigley:(916) 343-6410:250:100:175 Dan Savage:(406) 298-7744:450:300:275 Nancy McNeil:(206) 548-1278:250:80:75 John Goldenrod:(916) 348-4278:250:100:175 Chet Main:(510) 548-5258:50:95:135 To...

by wsxedcer - Shell - 2009-04-03 17:02:23 阅读(3647) 回复(10)