[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
For loop prints two $values instead of one
From: |
DanielB |
Subject: |
For loop prints two $values instead of one |
Date: |
Tue, 7 Jan 2014 00:45:42 +0200 |
I've a problem with bash array loop.
the following code instead of printing each value separately, joins two
values and prints them as if they are one.
declare -a array=( 'sf052' 'to060' 'pw' 'qb099' 'pw22' 'wp039' 'wx12'
'wx11' )for subD in "${array[@]}"; do
echo $subDdone
output:
sf052
to060
pw
qb099 pw22
wp039 wx12
wx11
"expected output":
sf052
to060
pw
qb099
pw22
wp039
wx12
wx11
bash --version
GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)
http://stackoverflow.com/questions/20960519/for-loop-prints-two-values-instead-of-one
- For loop prints two $values instead of one,
DanielB <=
Re: For loop prints two $values instead of one, Greg Wooledge, 2014/01/07