Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: MULTIOS input
On Jun 27, 12:40pm, Dave Yost wrote:
}
} Is this working correctly? I'm on Mac OS X 10.4.10.
It's not working incorrectly, I guess.
I'm not sure if this is part of your question, but the <<< operator
appends an implicit newline, so the newline you embedded in the
quotes makes two.
/dev/fd/0 refers to the standard input, which is NOT the standard input
of the subshell (the pipe from "echo line 2") -- it's the standard
input of "cat", which (when I try it on linux) is the <<< operator, so
I see "line 1\n\n" twice.
Whether that's what you get on some other OS depends on whether there
really is a /dev/fd/0 or whether zsh is simulating it, and possibly on
whether the I/O buffering is such that you can read the same input from
the /dev/fd device more than once.
} 0 298 Z% cat foo
} #!/usr/local/packages/zsh/bin/zsh
}
} echo ZSH_VERSION is $ZSH_VERSION
}
} setopt MULTIOS
}
} echo line 2 \
} | (
} cat <<< 'line 1
} ' < /dev/fd/0
} )
} 0 299 Z% ./foo
} ZSH_VERSION is 4.3.4
} line 1
}
} 0 300 Z%
}-- End of excerpt from Dave Yost
Messages sorted by:
Reverse Date,
Date,
Thread,
Author