Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: UNIX command cp

Re: UNIX command cp

From: <jkstill_at_teleport.com>
Date: Sat, 13 Jan 2001 14:27:38 -0800 (PST)
Message-Id: <10740.126624@fatcity.com>


The only problem with wild card expansion I've ever experienced is of the idiot user variety ( me in this case :)

  e.g. rm *>txt

when what I really meant was 'rm *.txt'

That's what happens when your finger drags on the shift key a little too long.

Jared

On Fri, 12 Jan 2001, yong huang wrote:

> I vaguely remember a long time ago somebody in a UNIX group says using wild
> cards in the cp command is dangerous, because after * expansion, the second
> file (the 2nd argument) gets overwritten by the first file (the 1st arg). Since
> then, I've always used
>
> for i in *; do
> cp $i $i.bak #or cp $i /somedir
> done
>
> But I can't reproduce that danger. Can anyone give an example?
>
> What triggered me to ask this is an interesting incident. Recently I inherited
> our production server and stayed late to test the cold backup script which I
> modified a little bit. From ps -ef | grep cp, I saw the command:
>
> cp /myoradatapath/system01.dbf /myoradatapath/system02.dbf
>
> Sweats came to my forehead!!
>
> What happens is that the C shell script the former DBA wrote is simply doing:
> cp /myoradatapath/* /anotherdir. But ps -ef only displays part of the expanded
> command.
>
> Anyway, can anyone give an example to show that cp * *.bak or the like
> overwrites files? Thanks.
>
> Yong Huang
> yong321_at_yahoo.com
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: yong huang
> INET: yong321_at_yahoo.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
Received on Sat Jan 13 2001 - 16:27:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US