Re: Mass renaming of files
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Sun, 25 Jun 2006 17:47:22 -0400
On 2006-06-25, R. Kannan wrote:
Chris F.A. Johnson wrote:
On 2006-06-24, R. Kannan wrote:It seems to work for me. (SuSE 9.0)
Chris F.A. Johnson wrote:
On 2006-06-24, Handover Phist wrote:Nope that does not work. You probably need..
I think you meant: A=$(( $A + 1 ))
A=1; for i in *.JPG; do mv $i file$A.jpg; A=`expr $A + 1`; done
I know of no shell generally available with Linux in which `expr $A
+ 1` will work and A=$(( $A + 1 )) will not. It will work with
bash, ash, dash, ksh, and pdksh (and zsh in POSIX mode).
You can get an old Bourne shell that doesn't do arithmetic from the
Heirloom Toolkit, but it is not part of any distribution.
As it should. Both A=$(( $A + 1 )) and "A=`expr $A + 1`" should
work in any shell where "for in *.jpg" works (which is any except
[t]csh). The former is much faster.
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
.
- Follow-Ups:
- Re: Mass renaming of files
- From: R. Kannan
- Re: Mass renaming of files
- References:
- Mass renaming of files
- From: sarak13_2000
- Re: Mass renaming of files
- From: Robert M. Riches Jr.
- Re: Mass renaming of files
- From: sarak13_2000
- Re: Mass renaming of files
- From: Handover Phist
- Re: Mass renaming of files
- From: Chris F.A. Johnson
- Re: Mass renaming of files
- From: R. Kannan
- Re: Mass renaming of files
- From: Chris F.A. Johnson
- Re: Mass renaming of files
- From: R. Kannan
- Mass renaming of files
- Prev by Date: Re: Mass renaming of files
- Next by Date: Re: C Library Missing?
- Previous by thread: Re: Mass renaming of files
- Next by thread: Re: Mass renaming of files
- Index(es):
Relevant Pages
|