Questions about windows support

Adam D. Ruppe destructionator at gmail.com
Mon Feb 20 19:24:44 PST 2012


On Tuesday, 21 February 2012 at 03:13:10 UTC, H. S. Teoh wrote:
> for x in *; mv $x dest/$x; done
>
> Easy. :)

And wrong!

What if the filename has a space in it? You can
say "$x", with quotes, to handle that.

But, worse yet... a leading dash? Another downside
with the shell expansion is the program can't tell if
that is an expanded filename or a user option.

In this case, the mv simply wouldn't work, but you
can get some bizarre behavior out of that if you
wanted to play with it.

try this some day as a joke:

$ mkdir evil-unix # toy directory
$ cd evil-unix
$ touch -- -l # our lol file
$ touch cool # just to put a file in there
$ ls
-l  cool
$ ls * # the lol file is interpreted as an option!
-rw-r--r-- 1 me users 0 2012-02-20 22:18 cool
$


imagine the poor newb trying to understand that!


More information about the Digitalmars-d mailing list