Afficher un message
Vieux 18/03/2008, 07h25   #1
Greg Russell
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut "read" array variables via pipe vs. redirection

I'm having a problem "read"ing array variables via a pipe, but it works
fine using redirection of stdin.

$ bash --version
GNU bash, version 3.1.17(1)-release ...

"${function}" produces e.g.:

566 269 732 435

"${function}" | read -a var; echo ${#var[@]} ${var[*]}
0

however:

"${function}" > file; read -a var < file; echo ${#var[@]} ${var[*]}
4 566 269 732 435

Is it possible to get the array variables assigned using the pipe
structure please? I don't wish to generate a temporary file if at all
possible.

  Réponse avec citation
 
Page generated in 0,04735 seconds with 9 queries