in reply to Re: move command
in thread move command

"+" and "-" should be avoided as the lead character. % is the var sigil used by the Windows shell (e.g. echo %PATH%, echo %1, etc). On second thought, maybe you should also drop

in case your application needs to run on Windows as well...

huh? Windows has no problems with lowercase letters, digits, underscores, and fewer problems than unix with the dash.

Replies are listed 'Best First'.
Re^3: move command
by rovf (Priest) on Jul 09, 2009 at 08:56 UTC
    Windows has no problems with lowercase letters

    Unfortunately it does. Try to create a file "FOO.TXT", and then create a new file "foo.txt". You will find that the second file "replaces" the first one. The reason is that Windows internally does not distinguish between lower and upper case. Well, this applies to Windows until XP. I don't know whether this has been fixed in Vista.

    and fewer problems than unix with the dash

    Partially true. Strictly speaking, Unix has no problem with dash, but you likely mean that the vast majority of Unix command line tools use the dash to denote switches, while the majority of Windows command line tools use a slash to denote a switch. Since there are still quite a few Windows utilities which also use a hyphen to denote a command line switch, you should avoid on Windows files starting with either a hyphen or a slash, while on Unix you will have a happier life if you don't have files starting with a hyphen, and a slash is ruled out as valid character anyway.

    Underscores, AFIK, are no problems in either OS. In Windows, there are some characters which you should avoid, since they have special meaning to the shell: caret (^), percent (%), double quotes ("), parentheses. Caret and percent are fine on Unix, but the others are better avoided there too. While Unix itself is tolerant on most characters, many of the shells on Unix have their own special characters, such as a tilde (~) on the starting position, or a $ sign.

    On Unix, I try to avoid characters which are special to the most common shells (bash, zsh, tcsh), not because it would be strictly necessary, but because it makes life easier. Given that at least tcsh is available on Windows as well - though it seems to be much less in use than on Unix -, I avoid these characters on Windows too.

    -- 
    Ronald Fischer <ynnor@mm.st>

      What you seem to be missing is while Windows is case-insensitive, it does remember the case of the name. If you create FOO.TXT, it will show up as FOO.TXT in a directory listing. If you create foo.txt, it will show up as foo.txt. Your suggestion would limit me to creating uppercase file names and that would be awful.

      You will find that the second file "replaces" the first one

      Not quite. The first file will be truncated, but its name will still be FOO.TXT, not foo.txt.

        Your suggestion would limit me to creating uppercase file names and that would be awful.
        Or only lowercase. While this seems overly restrictive, at least you don't run into the problem that within your application you seem to have two files which are conceptionally different (such as Makefile and makefile), but end up being the same file on the OS level.

        But I see that to completely rule out upper (or lower) case is too restrictive. For example Perl .pm files are usually written in mixed case. Still, for the files I create, I try to stick to lower case letters unless the circumstances really beg for upper/mixed case.

        -- 
        Ronald Fischer <ynnor@mm.st>