1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Echo randomly activated in script

Discussion in 'Support' started by thorsten, Sep 21, 2017.

  1. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    124
    Likes Received:
    0
    In the following snippet, echo is randomly activated (in this case on the fifth iteration):
    Code:
    @echo off
    
    do index = 1 to 1000
        :: disable audible beep for input
        option //BeepLength = 0
        echo ``
    
        echo %index
        delay 1
    enddo
    
    Loop, index, and delay are just to demonstrate the issue.

    This is the latest TCC version.
     

    Attached Files:

  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,860
    Likes Received:
    83
    The problem is with your "echo ``" statement, which is triggering an erratic bug in a Microsoft RTL function (reading past the end of the variable).

    But I don't understand why you're using "echo ``" - what are you trying to do with that statement?
     
  3. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    124
    Likes Received:
    0
    It's stripped down from a "shell selector" batch script:
    Code:
    @echo off
    setlocal & setdos /g., /x0
    on errormsg quit 1
    on break quit 1
    unalias * & unfunction *
    
    set config_=%@path[%_batchname]%@name[%_batchname].ini
    
    :: disable audible beep for input
    option //BeepLength = 0
    
    cls /c
    echo Enter shell
    echo  [1] TCC
    echo  [2] TCC/LE
    echo  [3] Cmd
    echo  [4] PowerShell
    echo  [5] Fish
    echo  [6] Zsh
    echo  [7] Bash
    echo ``
    
    inkey /k"1234567" Shell:  %%selection_
    
    echo ``
    iff     %selection_ == 1 then
        gosub READ_CONFIG Tcc
    
        cls /c
        tcc /q
    [...]
     
  4. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    124
    Likes Received:
    0
    "echo ``" s the equivalent of "echo." in TCC according to the documentation. It just echoes an empty line (in case I misinterpreted Rex' question).
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,860
    Likes Received:
    83
    Fixed in 21.01.52 (already uploaded).
     

Share This Page