Chinaunix

标题: 请教unix下,有哪些系统提供的函数可在shell下使用? [打印本页]

作者: ajljd    时间: 2005-09-29 16:34
标题: 请教unix下,有哪些系统提供的函数可在shell下使用?
unix下,要使用shell函数求一个变量的字符数,怎么写?另外还有哪些shell能用的函数?
作者: 寂寞烈火    时间: 2005-09-29 17:28
标题: 请教unix下,有哪些系统提供的函数可在shell下使用?
1,${#var}
2,
作者: waker    时间: 2005-09-29 17:34
标题: 请教unix下,有哪些系统提供的函数可在shell下使用?
http://chinaunix.net/jh/24/545252.html

估计需要的是这个
作者: twf_cc    时间: 2005-09-29 20:29
标题: 请教unix下,有哪些系统提供的函数可在shell下使用?
如果用bash , 內建變量擴展 ${#var}可以得到,
用 expr 如下
var="abcde"
expr length "$var"
作者: 林子    时间: 2005-09-29 21:53
标题: 请教unix下,有哪些系统提供的函数可在shell下使用?
fun()
{
Long=`echo $1|awk '{print length($0)'`
echo $Long
}

echo "input var:\c"
read var
fun $var




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2