hush: add a comment where we differ from bash wrt heredoc EOF mark handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
41fddb4372
commit
bb6f573ad2
@ -3861,6 +3861,13 @@ static int done_word(o_string *word, struct parse_context *ctx)
|
|||||||
* shell may perform it, but shall do so only when
|
* shell may perform it, but shall do so only when
|
||||||
* the expansion would result in one word."
|
* the expansion would result in one word."
|
||||||
*/
|
*/
|
||||||
|
//bash does not do parameter/command substitution or arithmetic expansion
|
||||||
|
//for _heredoc_ redirection word: these constructs look for exact eof marker
|
||||||
|
// as written:
|
||||||
|
// <<EOF$t
|
||||||
|
// <<EOF$((1))
|
||||||
|
// <<EOF`true` [this case also makes heredoc "quoted", a-la <<"EOF"]
|
||||||
|
//This contradicts the above docs.
|
||||||
ctx->pending_redirect->rd_filename = xstrdup(word->data);
|
ctx->pending_redirect->rd_filename = xstrdup(word->data);
|
||||||
/* Cater for >\file case:
|
/* Cater for >\file case:
|
||||||
* >\a creates file a; >\\a, >"\a", >"\\a" create file \a
|
* >\a creates file a; >\\a, >"\a", >"\\a" create file \a
|
||||||
@ -4228,6 +4235,7 @@ static int fetch_heredocs(int heredoc_cnt, struct parse_context *ctx, struct in_
|
|||||||
|
|
||||||
redir->rd_type = REDIRECT_HEREDOC2;
|
redir->rd_type = REDIRECT_HEREDOC2;
|
||||||
/* redir->rd_dup is (ab)used to indicate <<- */
|
/* redir->rd_dup is (ab)used to indicate <<- */
|
||||||
|
bb_error_msg("redir->rd_filename:'%s'", redir->rd_filename);
|
||||||
p = fetch_till_str(&ctx->as_string, input,
|
p = fetch_till_str(&ctx->as_string, input,
|
||||||
redir->rd_filename, redir->rd_dup);
|
redir->rd_filename, redir->rd_dup);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
heredoc1
|
|
||||||
Ok1:0
|
|
||||||
heredoc2
|
|
||||||
EO`false`F
|
|
||||||
Ok2:0
|
|
@ -1,10 +0,0 @@
|
|||||||
cat <<EO`true`F
|
|
||||||
heredoc1
|
|
||||||
EO`true`F
|
|
||||||
echo Ok1:$?
|
|
||||||
|
|
||||||
cat <<EO`true`F
|
|
||||||
heredoc2
|
|
||||||
EO`false`F
|
|
||||||
EO`true`F
|
|
||||||
echo Ok2:$?
|
|
Loading…
x
Reference in New Issue
Block a user