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: f678f,fb87ccfc9e8baf0a X-Google-Attributes: gidf678f,public X-Google-Thread: f71eb,fb87ccfc9e8baf0a X-Google-Attributes: gidf71eb,public X-Google-ArrivalTime: 1995-01-04 16:01:51 PST Newsgroups: comp.os.linux.misc,comp.os.os2.misc,comp.unix.osf.misc,comp.os.msdos.misc,comp.os.mach Path: nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!msunews!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!qus102!pclink From: pclink@qus102.qld.npb.telecom.com.au (Rick) Subject: copy *.doc *.bak (Was: Re: The big Question) Message-ID: Organization: Telecom Australia References: <3dpmo9$6fh@calvin.st-and.ac.uk> <3dupdf$7i4@hpscit.sc.hp.com> <3dvd4u$rmv@usenet.INS.CWRU.Edu> <1995Jan2.135536.27035@imec.be> <1995Jan4.051639.24693@prpa.philips.com> <8j2gPm2SMUF=81pmpJ@transarc.com> Date: Thu, 5 Jan 1995 00:01:51 GMT Xref: nntp.gmd.de comp.os.linux.misc:37639 comp.os.os2.misc:125445 comp.unix.osf.misc:2255 comp.os.msdos.misc:28447 comp.os.mach:3436 Jim_Mann@transarc.com writes: >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. Depends on your shell. zsh allows you to turn off globbing for selected commands. As an example, here's a Q&D rendition of the DOS rename command from my .zprofile: rename () { [ $# != 2 ] && { echo "usage: ren pat1 pat2" return 1 } srcpat=$(echo $1 | sed -e 's/\*/\\(.*\\)/') dstpat=$(echo $2 | sed -e 's/\*/\\1/') for i in `eval echo $1` ; do mv -i $i $(echo $i|sed -e "s/$srcpat/$dstpat/") || break done } alias ren="noglob rename" It only matches the first wildcard, doesn't handle `?', but it'll do "ren *.c *.c.old", and you can specify a path in the destination (ren *.doc backup/*.bak). Rick. -- Rick "JT" Lyons | The above bytes don't | Usenet before net uses you. Telecom Australia | represent the views or| C/C++/x86/X/Unix/DOS/Novell ACN 051 775 556 | opinions of Telstra. | Dyslexics of the world untie! work:pclink@qus102.qld.npb.telecom.com.au | play:rick@razorback.brisnet.org.au