Shell operation array Shell code. /test. sh & quot; 100,200300, 400500,600 & quot; hhhhwww.2cto.com description: the parameter delimiter is a space by default, so the array parameters are expanded with double quotation marks, shell code dd 'date + % Y % m % d _ % H % M % s' echo & quot; start... shell operation array Shell code. /test. sh "100,200 300,400 500,600" hhhh www.2cto.com description: the parameter delimiter is a space by default, so the array parameters are expanded in double quotation marks, shell code dd = 'date + % Y % m % d _ % H % M % s' echo "start datetime $ {dd}" arrayListParam = $1 printName = $2 arrayList = ($ arrayListParam) echo "length = $ {# arrayList [@]}" I = 0 while [$ I-lt $ {# arrayList [@]}]; do firstsplit = 'echo "$ {arrayList [$ I]}" | cut-d ", "-f1 'secondspsequence = 'echo" $ {arrayList [$ I]} "| cut-d", "-f2 'echo" $ {printName }_$ {firstsplit }: $ {secondsplit} "let I = I + 1 done dd = 'date + % Y % m % d _ % H % M % s' echo" end datetime $ {dd }" display result: shell Code start datetime 20130305_181428 length = 3 hhhh_100: 200 hhhh_300: 400 hhhh_500: 600 end datetime 201305_181428
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.