Some applications use hyphen as a CLI switch. Somebody correct me if I'm wrong, but I think some MSDOS apps do. Unix ones use both hyphen and double hyphen.
Another "reserved" character :-(
Some applications use hyphen as a CLI switch. Somebody correct me if I'm wrong, but I think some MSDOS apps do. Unix ones use both hyphen and double hyphen.
Another "reserved" character :-(
Thanks, Ted, I'll look out for it.
It's a sort of "reserved character", like asterisk and slash and query. The command interpreter claims it as a delimiter character, and doesn't pass it to the underlying app.
For example:
We have two files; "file 1" and "file 2" with whitespace in the filename.
From a command prompt:
$ do_some_operation_on file 1 file 2
will make the interpreter look for: "file", then "1", then "file", then "2", which will fail, since the filenames don't exist.
whereas if the filenames don't contain whitespace, the command will work.
To get around this:
In Unix, you would have to do:
$ do_some_operation_on file\\ 1 file\\ 2
or
$ do_some operation_on 'file 1' 'file 2'
IIRC, in Microsoft, it would be;
C:> do_some_operation_on "file 1" "file 2"
All OK, except when you want to do it from a shell script (batch file) where you don't know in advance what the filenames will be.
IIRC, DOS wouldn't let you use reserved characters in filenames (not sure about 0x20).
Spaces in file names is nothing new.
The OS software that Microsoft wrote for other non-IBM based computers allowed spaces in filenames. back to at least the early '80s. Microsoft wrote the Basic interpreter for the old Commodore PET line, VIC-20, C-64 and C-128 computers that also allowed spaces BEFORE the file name as well, and allowed 16 characters total so you could put a program on a disk that would stay at the top of the directory when it was sorted by simply prefacing it with a space.
Probably because of C: sscanf("Program Files", "%s", result) ends up with result being "Program".
Paul Burke
Not inside of a filename or URL. The blank is a separator, so only if the hyphen follows a blank will it be a command line switch.
And, with filenames with embedded blanks, quotes work also. At least in "bash" (Bourne-again shell).
Cheers! Rich
Heh. This isn't precisely true. The command interpreter will choke, yes, but with an open(filename) call (MS 'C'), the filename can contain just about anything. In fact, this used to be a pretty cute way to hide your pornos from prying eyes. ;-)
0FFh looks just like a blank, too, at least on M$DOS. :-)Cheers! Rich
Single quotes are string literals - what you get is exactly what you see. Double quotes "interpolate" - mostly used for variable substitution for shell scripts. (if you have a variable named, e.g. 'FN', then "$FN" is replaced with the contents of the variable). The backslash just inserts whatever the next character is as a literal.
HTH! Rich
That's true. I'd forgotten about things like gtk-config.
There's a subtle difference between single and double quotes in bash, that I've never been able fully to get my head around the rules of, so I use backslash quoting, mostly.
No they did not. Apple HFS and some Unix's of the time beat them to the punch. MS just assiduously copied every bad idea.
Have something to add? Share your thoughts — no account required.
Ask the community — no account required