Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: curiosity with here document.
On 11/26/2015 05:56 PM, Bart Schaefer wrote:
On Nov 26, 3:19pm, Ray Andrews wrote:
}
} lesson learned.
Except it's the wrong lesson!
Well no, it is a lesson to be careful trying to use here-docs to comment
blocks. As to why it goes off the rails, I was close to understanding it
anyway--I'd expect legal code like that to have some sort of truth
value, inconvenient as it may be. I'm not really surprised by the
correct understanding.
function three_commands {
command1; command2; command3
}
if three_commands; then ...
Sure, but in practice I don't think we see that sort of 'list' after an
'if' very often. It seems that only the truth value of the last
statement is acted upon as far as any 'if-then' structure, so as I said,
the original 'if' seems to be orphaned. So what? It's me put the
parser into that strange position, I'm not bitchin', it did what it had
to do. Don't want orphan tests? Don't make them.
And second, that [[ ... ]] is just a command like any other command,
it's not magically connected to "if".
That's the sort of fact that one might think one understands without
really understanding it. I probably can't hardly help C-ing it the C
way. I appreciate these deep corrections.
And third, that a here-document is just the standard input of the
command it follows, so
: <<END
some stuff
END
is (again for purposes of determining truth value) the same as
:
Yeah, I'm really not as thick as I seem about this. Wanting the
'comment' to be available at any point wasn't realistic. Not one of my
better questions.
BTW, I wish there was a way of going back to the archives and deleting
lousy questions, I'd sure cut out a pile of mine. Library of Babel.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author