Hi Using wildcard expansion, it is possible to unintentionally overwrite files. E.g. consider a directory with two text files, a.txt and b.txt.
$ ls a.txt b.txt $ cat a.txt I am A!! $ cat b.txt I am B!! $ cp a.txt cp: missing destination file operand after `a.txt' Try `cp --help' for more information. (--- this is correct behavior ---) $ cp *.txt (--- Forgot to give the destination directory ---) (--- command executes, equivalent to "cp a.txt b.txt" ---) $ cat b.txt I am A!! $ I don't think this could be intended or expected behavior in any scenario. I suggest that the cp behavior be modified to look for a destination file operand before expanding wildcards, in which case a command like "cp [options] wildcard-expr" would still exit with an error of missing destination file operand, even if the wildcard-expr expands to two or more files. The above behavior exists as of coreutils v 6.7. -- Regards, Anshul _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
