PCbanter

PCbanter (http://www.pcbanter.net/index.php)
-   General XP issues or comments (http://www.pcbanter.net/forumdisplay.php?f=18)
-   -   echo "one foo=bar" gives an unexpected result. Why ? (http://www.pcbanter.net/showthread.php?t=1109754)

R.Wieser March 18th 20 01:05 PM

echo "one foo=bar" gives an unexpected result. Why ?
 
Hello all.

I was thinking about how some characters are not allowed in filenames, and
tried to see if "=" is one of them.
So, I entered, on a commandline, the following: "one foo=bar".

To my surprise the contents of the file became "one =bar"

Can anybody tell me why that "one =bar" result ? (googeling is a bit hard on
it, with the lack of keywords).

Regards,
Rudy Wieser



JJ[_11_] March 18th 20 03:17 PM

echo "one foo=bar" gives an unexpected result. Why ?
 
On Wed, 18 Mar 2020 13:05:49 +0100, R.Wieser wrote:
Hello all.

I was thinking about how some characters are not allowed in filenames, and
tried to see if "=" is one of them.
So, I entered, on a commandline, the following: "one foo=bar".

To my surprise the contents of the file became "one =bar"

Can anybody tell me why that "one =bar" result ? (googeling is a bit hard on
it, with the lack of keywords).

Regards,
Rudy Wieser


Something is wrong with your system.

In my system...

This exact command line:

echo "one foo=bar"

It displays below line without creating any file.

"one foo=bar"

This exact command line:

"one foo=bar"

It displays below line without creating any file.

'"one foo=bar"' is not recognized as an internal or external command,
operable program or batch file.

This exact command line:

one foo=bar

It displays below lines, and creating an empty file named "foo".

'one' is not recognized as an internal or external command,
operable program or batch file.

For the last command line, "foo=bar" file is not created because the "="
character is considered as whitespace if it's not wrapped by double quotes.

R.Wieser March 18th 20 04:37 PM

echo "one foo=bar" gives an unexpected result. Why ?
 
JJ,

So, I entered, on a commandline, the following: "one foo=bar".


My apologies, as I see that I somehow left the word "echo" out in the body
of the message, and placed the double-quotes wrong in the subjectline. :-(

The full commandline I used is (without the doublequotes ofcourse) "echo one
foo=bar"


This exact command line:

echo "one foo=bar"


:-) /allmost/ the same one.

Regards,
Rudy Wieser



JJ[_11_] March 19th 20 08:25 AM

echo "one foo=bar" gives an unexpected result. Why ?
 
On Wed, 18 Mar 2020 16:37:25 +0100, R.Wieser wrote:
JJ,

So, I entered, on a commandline, the following: "one foo=bar".


My apologies, as I see that I somehow left the word "echo" out in the body
of the message, and placed the double-quotes wrong in the subjectline. :-(

The full commandline I used is (without the doublequotes ofcourse) "echo one
foo=bar"


This exact command line:

echo "one foo=bar"


:-) /allmost/ the same one.

Regards,
Rudy Wieser


Two reasons:
1. The "=" character is treated as delimiters.
2. CMD processes redirection syntax first.

Thus the command line:

echo one foo=bar

CMD recognizes the " foo" syntax as redirection. It stops before the "="
delimiter. Then strips it out from the command line. After the redirection
has been processed, the command line becomes:

echo one =bar

Then that "one =bar" is outputed.

This is similar case when there's a file named "foo=bar" and below command
line is executed.

dir foo=bar

That ends up making DIR listing two files: "foo" and "bar". It's output
would be like this.

Volume in drive E is SOMETHING
Volume Serial Number is 1111-1111

Directory of E:\TEST


Directory of E:\TEST

File Not Found

Notice that it shows two "Directory of..." lines, instead of one.

R.Wieser March 19th 20 09:16 AM

"echo one foo=bar" gives an unexpected result. Why ?
 
JJ,

(the subjectline has been corrected)

1. The "=" character is treated as delimiters.


Even on the commandline (and not just for batchfile commands) ? I never
knew that. Thanks.

dir foo=bar

That ends up making DIR listing two files: "foo" and "bar".


Which also happens with that "=" replaced by a space ... (in other words,
not something that happens because of that delimiter).

I've just done a (bit less than) quick search for a description of what that
"=" sign actually does/is for on the commandline, but got nowhere fast (a
lot of "how to escape it" or "what does it do in a batchfile" stuff though).

The problem (of sorts) is that I can see what it does, but have no idea (and
can't seem to find) what its purpose is. Currently all I have is a "look
people, this is funny!" application of it.

As my google-fu seems to be weak on this, do you have, by any chance, a link
to a description to what its ment for ?

Regards,
Rudy Wieser



JJ[_11_] March 20th 20 05:09 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
On Thu, 19 Mar 2020 09:16:42 +0100, R.Wieser wrote:

I've just done a (bit less than) quick search for a description of what that
"=" sign actually does/is for on the commandline, but got nowhere fast (a
lot of "how to escape it" or "what does it do in a batchfile" stuff though).

The problem (of sorts) is that I can see what it does, but have no idea (and
can't seem to find) what its purpose is. Currently all I have is a "look
people, this is funny!" application of it.

As my google-fu seems to be weak on this, do you have, by any chance, a link
to a description to what its ment for ?


No idea either. There doesn't seem to be any official documentation about it
or the other semicolon and comma delimiters. Not even example of their
specific usage. The leaked Windows NT source codes may shed some light on
this issue.

CMD is a mysterious (or perhaps, buggy) command interpreter. For example, I
found that the "" character when not used for redirection, is treated as
(no quotes) "?.". And the "" character when not used for redirection, is
treated as (no quotes) "*.". At least for DIR command. e.g.

dir ^
dir ^^
dir ^
dir a^

Would be same as:

dir ?.
dir ??.
dir *.
dir a*.

R.Wieser March 20th 20 05:47 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
JJ,

No idea either. There doesn't seem to be any official documentation
about it or the other semicolon and comma delimiters.


Bummer.

For example, I found that the "" character when not used for redirection,
is treated as (no quotes) "?.". And the "" character when not used for
redirection, is treated as (no quotes) "*.". At least for DIR command.


Whut ? What good does that do (duplicating already existing functionality)
?

Its nice to be used for obsfucation though (like entering IPv4 adresses as a
single, 32-bit number).

Regards,
Rudy Wieser



pyotr filipivich March 21st 20 05:26 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
JJ on Fri, 20 Mar 2020 23:09:43 +0700 typed in
microsoft.public.windowsxp.general the following:
On Thu, 19 Mar 2020 09:16:42 +0100, R.Wieser wrote:

I've just done a (bit less than) quick search for a description of what that
"=" sign actually does/is for on the commandline, but got nowhere fast (a
lot of "how to escape it" or "what does it do in a batchfile" stuff though).

The problem (of sorts) is that I can see what it does, but have no idea (and
can't seem to find) what its purpose is. Currently all I have is a "look
people, this is funny!" application of it.

As my google-fu seems to be weak on this, do you have, by any chance, a link
to a description to what its ment for ?


No idea either. There doesn't seem to be any official documentation about it
or the other semicolon and comma delimiters. Not even example of their
specific usage. The leaked Windows NT source codes may shed some light on
this issue.

CMD is a mysterious (or perhaps, buggy) command interpreter. For example, I
found that the "" character when not used for redirection, is treated as
(no quotes) "?.". And the "" character when not used for redirection, is
treated as (no quotes) "*.". At least for DIR command. e.g.

dir ^
dir ^^
dir ^
dir a^

Would be same as:

dir ?.
dir ??.
dir *.
dir a*.


cool beanz.
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?

pyotr filipivich March 21st 20 05:26 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
"R.Wieser" on Fri, 20 Mar 2020 17:47:47 +0100
typed in microsoft.public.windowsxp.general the following:
JJ,

No idea either. There doesn't seem to be any official documentation
about it or the other semicolon and comma delimiters.


Bummer.

For example, I found that the "" character when not used for redirection,
is treated as (no quotes) "?.". And the "" character when not used for
redirection, is treated as (no quotes) "*.". At least for DIR command.


Whut ? What good does that do (duplicating already existing functionality)?


I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?

R.Wieser March 21st 20 08:10 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
pyotr,

but kind of a PITA as you had to learn both ways.


:-) Thats exactly what my "whut ?" was for.

Reminded me of the time I wound up trying to learn Boolean
Algebra in two separate classes, with two separate sets of notation.
I got the concepts, mostly, but still have trouble "reading" the
statements.


My favorite language (Assembly) uses one notation in the sourcecode, and
another in the resource file. I've been using the wrong one for the
thanwhile file many times. :-\

Regards,
Rudy Wieser



J. P. Gilliver (John)[_7_] March 23rd 20 10:58 AM

"echo one foo=bar" gives an unexpected result. Why ?
 
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.


Why did you have to learn both ways?

Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.

--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

Once you've started swinging, chimp-like, through the branches of your family
tree, you might easily end up anywhere. - Alexander Armstrong, RT 2014/8/23-29

pyotr filipivich March 23rd 20 08:03 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
"J. P. Gilliver (John)" on Mon, 23 Mar 2020
09:58:37 +0000 typed in microsoft.public.windowsxp.general the
following:
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.


Why did you have to learn both ways?


Sort of "why is this not working right? Oh, that's the other way,
and it is incomplete!".
It's been a few decades.

Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).


There is always an element of "Okay, I know what I want to do, how
do I do it 'here'?" where 'here' is a programming language, GUI,
command line, wood shop, car dashboard, etc.

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.


--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?

J. P. Gilliver (John)[_7_] March 24th 20 11:16 PM

"echo one foo=bar" gives an unexpected result. Why ?
 
On Mon, 23 Mar 2020 at 12:03:04, pyotr filipivich
wrote:
"J. P. Gilliver (John)" on Mon, 23 Mar 2020
09:58:37 +0000 typed in microsoft.public.windowsxp.general the
following:
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.


Why did you have to learn both ways?


Sort of "why is this not working right? Oh, that's the other way,
and it is incomplete!".


Ah, so it didn't _really_ have two ways of doing things (or at least
some things), just _claimed_ that it did. (I didn't spot the quote marks
in what you said the first time.)

It's been a few decades.

(-:

Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).


There is always an element of "Okay, I know what I want to do, how
do I do it 'here'?" where 'here' is a programming language, GUI,
command line, wood shop, car dashboard, etc.


Yes. I'm not good at learning different UIs: I'm reasonably familiar
with Windows (up to 7), but find Android (and iOS) very difficult. Which
I don't think they really are - it's just that they're very different to
what I'm used to. (W10 is also different, but in a different way.)

Reminded me of the time I wound up trying to learn Boolean Algebra
in two separate classes, with two separate sets of notation. I got
the concepts, mostly, but still have trouble "reading" the statements.


--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

Science fiction is escape into reality - Arthur C Clarke

pyotr filipivich March 25th 20 07:01 AM

"echo one foo=bar" gives an unexpected result. Why ?
 
"J. P. Gilliver (John)" on Tue, 24 Mar 2020
22:16:33 +0000 typed in microsoft.public.windowsxp.general the
following:
On Mon, 23 Mar 2020 at 12:03:04, pyotr filipivich
wrote:
"J. P. Gilliver (John)" on Mon, 23 Mar 2020
09:58:37 +0000 typed in microsoft.public.windowsxp.general the
following:
On Sat, 21 Mar 2020 at 09:26:16, pyotr filipivich
wrote:
[]
I recall a desktop publishing SW package which had "at least two
ways to do everything." Which was kind of neat, but kind of a PITA as
you had to learn both ways.

Why did you have to learn both ways?


Sort of "why is this not working right? Oh, that's the other way,
and it is incomplete!".


Ah, so it didn't _really_ have two ways of doing things (or at least
some things), just _claimed_ that it did. (I didn't spot the quote marks
in what you said the first time.)


I do remember giving the presentation to the class and saying
something to that effect.
As I am remembering, it seemed to have two sets of codes to insert
for Italics / Bold. For some reason I'm remembering that some codes
had a "Start here" and an "end here".
Or I could be thinking of HTML, of which I've never gone into at
any great depth.
It's been a few decades.
Windows, of course, has multiple ways to do most things (most of which
we here probably all use without thinking).

There is always an element of "Okay, I know what I want to do, how
do I do it 'here'?" where 'here' is a programming language, GUI,
command line, wood shop, car dashboard, etc.


Yes. I'm not good at learning different UIs: I'm reasonably familiar
with Windows (up to 7), but find Android (and iOS) very difficult. Which
I don't think they really are - it's just that they're very different to
what I'm used to. (W10 is also different, but in a different way.)


Yes. I'm hacking word and firefox over my wife's shoulder. as in
"Aah, try clicking on that thingy there."
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?


All times are GMT +1. The time now is 02:11 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2006 PCbanter
Comments are property of their posters