An analysis of the number of string operations supported by Bash is surprising. unfortunately, these tools lack unified standards. some are the subset of parameter replacement, while others are affected by the UNIXexpr command. this leads to inconsistent command syntax and causes... brief analysis on the number of string operations supported by Bash is surprising. unfortunately, these tools lack unified standards. some are subset of parameter replacement, while others are affected by the UNIX expr command. this leads to inconsistent command syntax and redundant functions, but these are not confusing. method to obtain the string length: 1 $ {# string} 2 expr length $ string 3 expr "$ string ":'. * 'root @ ubuntu :~ /Resource/shell-study/0507-2013 # string = "abcdefg" root @ ubuntu :~ /Resource/shell-study/0507-2013 # echo $ {# string} 7 root @ ubuntu :~ /Resource/shell-study/0507-2013 # echo 'expr length $ string' 7 root @ ubuntu :~ /Resource/shell-study/0507-2013 # echo 'expr "$ string": '. *' 7 root @ ubuntu :~ /Resource/shell-study/0507-2013 # How to Learn: Insert blank lines between paragraphs in a text file #! /Bin/bash MINLEN = 3 while read line do echo "$ line" len =$ {# line} if ["$ len"-lt "$ MINLEN"]; then echo fi done exit 0 Result: root @ ubuntu :~ /Resource/shell-study/0507-2013 #./test6.sh
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service