`

使用函数

 
阅读更多
testfun.sh
fun()
{
    printf "test fun\n"
}

fun


testfun2.sh
equalFun()
{
    case "$1" in "$2")
        return 0
    esac
        return 1
}


printf "input first string: \n"

read $str1

printf "input second string:\n"

read $str2

if equalFun "$str1" "$str2"
then
    printf "equal\n"
else
    printf "not equals\n"
fi

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics