[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wildcard feature?
From: |
Philip Rowlands |
Subject: |
Re: wildcard feature? |
Date: |
Mon, 11 Sep 2006 13:41:03 +0100 (BST) |
On Mon, 11 Sep 2006, Werner Adler wrote:
if I have two files with the same ending (could be any part of the
name), say 1.test and 2.test, and I want to copy both files to a
directory, but accidently type "return" before entering the directory
name:
cp *.test
the second file is overwritten by the first file (I expected to get an
error message and was pretty surprised about that behaviour). (Funny)
Feature or bug?
Feature. cp doesn't actually see that you used a wildcard, as the shell
has already expanded it. Try "echo cp *.test" to see what arguments cp
gets passed.
cp does have an --interactive (-i) flag available which will cause it to
prompt the user before overwriting any files. Some distributions choose
to make a shell alias for rm, mv, and cp to include this flag for the
root user, to prevent catastrophic damage from a typo.
Cheers,
Phil