(There is some processing done to this command tail by a command interpreter before it is passed to the target program, but it isn't related to word splitting.) On Win32, the operating system itself operates in terms of a command tail: a single long string that still contains all of the quotation marks that one originally typed on the command line. On Unices and Linux, the shell does the word splitting, because the operating system actually works in terms of an argument string array. In Win32 programs, splitting up the command line into "words" - the NUL-terminated multi-byte character strings that programs in the C and C++ languages see as the argument array passed to main() - is the province of the runtime libraries of those programs. ( A command prompt is the thing displayed by a command interpreter.) Second, your command interpreter, the prompts that it issues, and Win32 consoles, have nothing at all to do with this. And this is the essence of my question.įirst, a command prompt is not a command interpreter. One can clearly see that Windows does not treat single quotes as double quotes. Here is the Unix console log: ~]$ python 1.py "1 2 3"Īnd here is the respective Windows console log: C:\Work>python 1.py "1 2 3" So, I have created a tiny python program to mimic the command line processing used by mercurial: import sys Mercurial entry point looks like so (it is a python program): def run(): Is it possible to instruct the Windows command prompt to treat single quotes similarly to the double one?įollowing the reply by JdeBP I have done a little research. I have to edit the command after paste and it is annoying. When a single quoted string is passed on the Windows command prompt, the latter does not recognize that everything between the single quotes belongs to one string.įor example, the following command: hg commit -m 'Initial commit'Ĭannot be pasted as is in a command prompt, because the latter treats 'Initial commit' as two strings - 'Initial and commit'. The problem is that the samples in the book use single quoted strings. My scenario is simple - I am copying script samples from the Mercurial online book and pasting them in a Windows command prompt.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |