Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Line continuation in the shell command

    I am looking for a way to continue a shell escape on another line. Here is an example of what happens when I use /// to continue the line:

    . ! echo asdf ///
    asdf ///


    As you can see, the /// seems to be taken as part of the shell command. I also tried /*<cr>*/. and note that -winexec- and -shell- behave in the same way. There is a space before the /// and none after, so that isn't the problem. Interestingly enough, the text of the command is scanned for macros, and macro substitution does take place. I am working with Stata 15 in Windows and Linux.

    .

  • #2
    I don't know about a continuation, but what about putting your second line into a local macro?
    Code:
    local next "Now is the time for all good persons to come to the aid of their party."
    !echo `next'

    Comment


    • #3
      I believe the poster is asking for a way to break a line in an bash "echo" output. I would recommend:
      Code:
      !echo "line 1\nline 2"
      Best regards.

      Comment


      • #4
        I believe the problem is that you typed a line continuation "///" into Stata's Command window. Line continuation is not supported in the command window, only in do-files and ado-files and the like.
        Code:
        . ! echo asdf ///
        
        asdf ///
        
        . xkyz
        command xkyz is unrecognized
        r(199);
        
        . do "/var/folders/xr/lm5ccr996k7dspxs35yqzyt80000gp/T//SD63849.000000"
        
        . ! echo asdf ///
        > xkyz
        
        asdf xkyz
        
        . 
        end of do-file
        
        .

        Comment


        • #5
          I never thought of that. Yes, you are right, it does work in a do file. Thanks.

          Comment

          Working...
          X