Re: cp should look for destination file operand BEFORE wildcard expansio
From:
Pádraig Brady
Subject:
Re: cp should look for destination file operand BEFORE wildcard expansion
Date:
Tue, 20 Feb 2007 13:15:10 +0000
User-agent:
Thunderbird 1.5.0.8 (X11/20061116)
Anshul Nigham wrote:
> 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.
>
> $ cp *.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
cp doesn't expand wildcards, the shell does.
So all cp sees is the individual params: a.txt b.txt
Pádraig.