🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1101

Re: How to do mv *.xyz *.abc in shell script??

#1101
From: Lawrence H. Miller
Date: Fri, 07 Sep 1990 16:52
19 lines
1039 bytes
One way to do this is to use basename.  Try something like this (for
you specific case of changing *.xyz to *.abc).

(This is a Bourne shell script.)

------------------------------ CUT HERE ------------------------------ 

for i in *.xyz
do
  a=`basename $i .xyz`
  echo moving $a.xyz to $a.abc
  mv $a.xyz $a.abc
done

Larry Miller
Aerospace Corporation
lmiller@aerospace.aero.org
213-336-5597
Technical Details
Message-ID: <84985@aerospace.AERO.ORG>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!aero!aerospace.aero.org!lmiller
References: <5569@minyos.xx.rmit.oz> <975@ria.ccs.uwo.ca> <MCDANIEL.90Sep7110028@dolphin.adi.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!aero!aerospace.aero.org!lmiller
From: lmiller@aerospace.aero.org (Lawrence H. Miller)
Newsgroups: comp.unix.shell
Subject: Re: How to do mv *.xyz *.abc in shell script??
Message-ID: <84985@aerospace.AERO.ORG>
Date: 7 Sep 90 16:52:37 GMT
References: <5569@minyos.xx.rmit.oz> <975@ria.ccs.uwo.ca> <MCDANIEL.90Sep7110028@dolphin.adi.com>
Sender: news@aerospace.aero.org
Reply-To: lmiller@armadillo.UUCP (Lawrence H. Miller)
Organization: The Aerospace Corporation, El-Segundo, CA
Lines: 19