Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: serouner@mutt.piper.hamline.edu (Sara E Rouner)
Subject: Re: copy *.doc *.bak (Was: Re: The big Question)
Date: 05 Jan 1995 20:36:18 GMT	[thread overview]
Message-ID: <SEROUNER.95Jan5143618@mutt.piper.hamline.edu> (raw)
In-Reply-To: pclink@qus102.qld.npb.telecom.com.au's message of Thu, 5 Jan 1995 00:01:51 GMT

>>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


             reply	other threads:[~1995-01-05 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-01-05 20:36 Sara E Rouner [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-12-27 18:34 The big Question John Laing Page
1994-12-29 16:50 ` Lee Sailer
1994-12-29  8:12   ` Darko Volaric
1994-12-29 22:27     ` Bob Hetzel
1994-12-31 16:10       ` cdlevin
1995-01-02 13:55         ` Steven Buytaert
1995-01-04  5:16           ` Ross Morley
1995-01-04 16:04             ` Jim_Mann
1995-01-05  0:01               ` copy *.doc *.bak (Was: Re: The big Question) Rick
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox