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

Issue with unset?

Discussion in 'Support' started by Jim Cook, Jun 23, 2008.

  1. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    TCC 9.02.151 Windows XP [Version 5.1.2600]
    TCC Build 151 Windows XP Build 2600 Service Pack 3

    I find this UNSET behavior very curious. Why doesn't the second one
    say "Not in environment" also?

    D:\>unset *

    [D:\]unset q
    TCC: Not in environment "q"

    [D:\]unset q[


    If I actually make a variable called q[ it seems I can't remove it
    unless I use SET Q[= with nothing following; unset won't do it.

    [D:\]set q[=123

    [D:\]set q*
    q[=123

    [D:\]echo %[q[]
    123

    [D:\]unset q[

    [D:\]echo %[q[]
    123

    [D:\]set q[
    [D:\]echo %[q[]
    ECHO is OFF

    --
    2008 Fridays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Saturday.
    Measure wealth by the things you have for which you would not take money.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,667
    Likes Received:
    80
    Jim Cook wrote:

    That's a wildcard delete (albeit with invalid syntax) and UNSET doesn't
    report an error on wildcard deletes.

    (Actually, in Vista, it doesn't return an error if the variable doesn't
    exist, because it's using a Windows API and in Vista that API doesn't
    return an error.)


    UNSET thinks it's a wildcard, rather than a malformed variable name.

    Rex Conn
    JP Software
     

Share This Page