Skip to content

single quoted heredoc token cannot find end #99

Open

Description

@WillForan

HREDOCs with surrounding single quote are ended with the token sans quotes

cat << 'EOF'
$literal `values` "without" 'interpolation'
EOF

but bashlex expects an end token with the quotes

here-document at line 0 delimited by end-of-file (wanted "'EOF'") (position 16)

when trying

bashlex.parse(": <<'EOF'\nx\nEOF")

ending with the included quotes 'EOF' works for bashlex but not bash

bashlex.parse(": <<'EOF'\nx\n'EOF'")

[CommandNode(parts=[WordNode(parts=[] pos=(0, 1) word=':'), RedirectNode(heredoc=HeredocNode(pos=(10, 17) value="x\n'EOF'") input=None output=WordNode(parts=[] pos=(4, 9) word="'EOF'") pos=(2, 17) type='<<')] pos=(0, 9))]

bash -c "cat <<'EOF'
x
'EOF'"

bash: line 3: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')

Activity

  1. changed the title [-]single quoted heredoc [/-] [+]single quoted heredoc token cannot find end[/+] on Dec 29, 2024
  2. added 2 commits that reference this issue on Dec 29, 2024
    197cf57
    c8058c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions