>$ echo "${X}" > ${Z} >bash: ${Z}: ambiguous redirect > >I want to append all variables in X and Y into Z so that "echo $Z" should be: >XX1=YES XX2=YES YY1=YES YY2=YES Redirection is not the right way to do it. Just do this: $ Z="$X $Y" $ echo $Z XX1=YES XX2=YES YY1=YES YY2=YES