Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-24-2010, 12:41 PM   #16
LQ Newbie
Registered: Feb 2010
Posts: 13

Original Poster
Rep: Reputation: 0


Can you explain what the 'i' variable is doing in this code? I know that it works but i don't understand what is going on.

for ((i=0; i < ${#orignames[*]} ; i++))
Specifically, I don't understand what this section means:
i < ${#orignames[*]}
I understand that '${#orignames[*]}' returns the length of the array, but in don't understand what 'i < ${#orignames[*]}' means.

Also I assume that
means add 1 to the variable 'i' each time the loop runs. Is that correct?
Old 02-24-2010, 12:46 PM   #17
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
First, it sets i=0
Then, the loop runs as long as the test (i< stuff) is true ( "<" in this context means "less than" )

i++ does exactly what you guessed
1 members found this post helpful.
Old 02-24-2010, 01:52 PM   #18
LQ Newbie
Registered: Feb 2010
Posts: 13

Original Poster
Rep: Reputation: 0
I like that. Thanks
Old 02-24-2010, 03:33 PM   #19
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,144

Rep: Reputation: 886Reputation: 886Reputation: 886Reputation: 886Reputation: 886Reputation: 886Reputation: 886
sorry i havent read many of the responses but this seems to be close to what you want: [untested]
for item in "`paste old-file-names.txt new-file-names.txt`"
 mv "$item"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming multiple files Changes Linux - Newbie 1 02-01-2009 09:58 PM
renaming multiple files yanchina12 Linux - Newbie 5 12-21-2007 07:56 AM
Combine multiple one column text file into one text file with multiple colum khairilthegreat Linux - Newbie 7 11-23-2007 01:31 PM
Steps needed to convert multiple text files into one master text file jamtech Programming 5 10-07-2007 11:24 PM
Renaming multiple files ajcns Linux - Newbie 2 01-19-2007 11:04 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration