Board logo

标题: Linux shell变量长度表达式 [打印本页]

作者: linda    时间: 2023-2-24 15:50     标题: Linux shell变量长度表达式

str="this is a string"
n=${#str}
echo "Length of the string is : $n "

参考:
https://www.geeksforgeeks.org/how-to-find-length-of-string-in-bash-script/

[ 本帖最后由 linda 于 2023-2-24 15:53 编辑 ]




欢迎光临 中神通公司交流论坛 (http://trustcomputing.com.cn/bbs/) Powered by Discuz! 6.0.0