Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Issue with unset?

May
603
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.
 
Jim Cook wrote:

> 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[

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.)


> 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.

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

Rex Conn
JP Software
 

Similar threads

Back
Top