Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: joining array elements



Hi Peter,

I am not sure if I understand your question about the nullglob option, but regardless of the nullglob option,

  echo $foo

didn't output the right thing. The difference between having or not having the nullglob option was, no output when nullglob option was set versus the following output when the nullglob option was turned off.

  zsh: no matches found: David\nMatt\nBob[return]Sara[return]Tim

print -r "$foo" worked under both conditions. Actually, I wanted to pass the value to a command (zsh function), so the two examples you gave me,

  usernames=(Bob Sara Tim)
  usernames2=(David Matt ${(j.[return].)~~usernames})
  foo=${(F)~~usernames2}

  usernames=(Bob Sara Tim)
  usernames2=(David Matt "${(j.[return].)usernames}")
  foo="${(F)usernames2}"

are exactly what I was looking for.  They work perfectly.

Thank you very much.  I really appreciate all the help.

Wataru Kagawa



Messages sorted by: Reverse Date, Date, Thread, Author