bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp should look for destination file operand BEFORE wildcard expansio


From: Eric Blake
Subject: Re: cp should look for destination file operand BEFORE wildcard expansion
Date: Tue, 20 Feb 2007 13:21:06 +0000

> Using wildcard expansion, it is possible to unintentionally overwrite
> files. E.g. consider a directory with two text files, a.txt and b.txt.

Thanks for the report.  However, this is not cp's problem.  Look at
the output of

$ echo cp *.txt

to learn what cp actually sees, and you will notice that the shell
already expanded the wildcard prior to invoking cp.  There is
nothing coreutils can do about your situation.

However, you can use other shell features, such as aliases
or shell functions, to enable other features of cp by default
when invoking cp in an interactive manner.  For example,
this is a pretty common idiom:

$ alias cp='cp -i'

-- 
Eric Blake





reply via email to

[Prev in Thread] Current Thread [Next in Thread]