Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-552

Lost $ within literal blocks when not followed by alpha

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.5
    • 1.6
    • Engine
    • None
    • Windows XP or Solaris, JDK 1.4.2_10

    Description

      This is probably the same root cause as #355 (lost #s).
      I was happy to find the #literal() directive in the user guide, because I intend to output SH script from Velocity, which could otherwise get messy. Unfortunately, under certain circumstances, $s are being gobbled.
      Consider this VTL fragment:
      #literal()
      export $VAR=$(echo $testme)
      #end

      Run through evaluate, this spits out
      export $VAR=(echo $testme)

      which isn't very literal (and is a compilation fault in SH). Even more odd,
      #literal()
      export $VAR=\$(echo $testme)
      #end

      outputs
      export $VAR=(echo $testme)

      Did some further testing on it, and if the $ isn't followed by alpha, it gets gobbled, but only inside a literal block.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            dtertman Dan Ertman
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment