#bin/bash
STR=”1234567890asdfghjkl”
echo “first character ${STR:0:1}”
echo “The three characters ${STR:0:3}”
echo “第四个字符开始显示:${STR:3}”
echo “显示第4到6个字符:${STR:3:3}”
echo “显示最后1个字符:${STR:0-1}”
echo “显示最后3个字符:${STR:0-3}”
echo “从右边数第7个,取3个字符${STR:0-7:3}”
STR=”1234567890asdfghjkl”
echo “first character ${STR:0:1}”
echo “The three characters ${STR:0:3}”
echo “第四个字符开始显示:${STR:3}”
echo “显示第4到6个字符:${STR:3:3}”
echo “显示最后1个字符:${STR:0-1}”
echo “显示最后3个字符:${STR:0-3}”
echo “从右边数第7个,取3个字符${STR:0-7:3}”
© 版权声明
文章版权归作者所有,未经允许请勿转载。