From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1044c2,fb87ccfc9e8baf0a X-Google-Attributes: gid1044c2,public X-Google-Thread: 1103af,fb87ccfc9e8baf0a X-Google-Attributes: gid1103af,public X-Google-Thread: f66ab,fb87ccfc9e8baf0a X-Google-Attributes: gidf66ab,public X-Google-Thread: f71eb,fb87ccfc9e8baf0a X-Google-Attributes: gidf71eb,public X-Google-Thread: f678f,fb87ccfc9e8baf0a X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1995-01-06 11:28:59 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!sgigate.sgi.com!sgiblab!spool.mu.edu!howland.reston.ans.net!gatech!swiss.ans.net!paperboy.amoco.com!apctrc!msc.edu!uc.msc.edu!serouner From: serouner@mutt.piper.hamline.edu (Sara E Rouner) Newsgroups: comp.os.linux.misc,comp.os.os2.misc,comp.unix.osf.misc,comp.os.msdos.misc,comp.os.mach Subject: Re: copy *.doc *.bak (Was: Re: The big Question) Date: 05 Jan 1995 20:36:18 GMT Organization: Hamline University Distribution: world Message-ID: NNTP-Posting-Host: mutt.hamline.edu In-reply-to: pclink@qus102.qld.npb.telecom.com.au's message of Thu, 5 Jan 1995 00:01:51 GMT Xref: nntp.gmd.de comp.os.linux.misc:37644 comp.os.os2.misc:125477 comp.unix.osf.misc:2256 comp.os.msdos.misc:28451 comp.os.mach:3438 >>On the other hand, because of this, I believe DOS will allow you to >>issue a command like: >>>copy *.doc *.bak >>and have it do the right thing (copy a.doc to a.bak, b.doc to b.bak, >>and so forth). Because the shell handles expansion in UNIX, UNIX >>can't do this sort of thing. I recognize this thread for what it is.. pure flame bait.. but I can't sit on my hands and let an incorrect statement like this go by unattended. Expansion is a major strength of sh-programming.. and so is parameter execution. You really need to know that sort of stuff to get the most from UNIX. A UNIX user will opt to use a sh-command line like: for f in *.doc; do cp $f `basename $f .doc`.bak; done or, if the list of files is small enough, a sh-command line like: for f in a b and so forth; do cp $f.doc $f.bak; done Do you need a script for your UNIX account? Is that what you're really asking for? Well, this one should work: #!/bin/sh ## cpx: copies a set of files with the same ext. to a different ext. ## example: to copy all *.doc files to *.bak -- cpx doc bak for f in *.$1; do cp $f `basename $f .$1`.$2; done