
On 15 June 2010 08:09, Beman Dawes <bdawes@acm.org> wrote:
Using double quotes as delimiters works well for legitimate uses in both Windows and bash shells, is readable by humans, and avoids the need for escapes in the vast majority of all real-world path names.
Unless someone accidentally makes a filename with a $ in it, or in bash one one with a ! in it, or in windows one with two %s in it.
In your example, the call to system would become system("rm \"-f x\""), and that will be harmless for both Windows and bash shells.
Except that in linux, the rm command sees the - and gives an argument parsing error. That's by no means the fault of the filesystem library, but it's be great if it were handled gracefully, since we have a type system and know that the coder isn't trying to specify flags. (I suppose theoretically there could be a problem in windows too, with a linux-thinking script running something like "del /test.txt" and getting "Invalid switch - "test.txt".")