On Tue, Jan 07, 2014 at 12:45:42AM +0200, DanielB wrote: > 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
I can only guess that your terminal is in some weird state, and/or your IFS variable has been set to something bizarre. The hypothesis about your terminal being in a weird state is somewhat strengthened by the mangling that was done in your email. If you properly quote "$subD" it will avoid any issues with IFS: for subD in "${array[@]}"; do echo "$subD" done Apart from the mangled formatting and the missing quotes, there's nothing wrong with your code. As for the terminal, you can try running the "reset" command, but in the most spectacular cases, it's often necessary to close the terminal window and open a new one (assuming a terminal emulator), or power the terminal off and back on (assuming a physical ASCII terminal).