LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Original Poster
Rep: Reputation: 0

Colucix,

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.

Quote:
for ((i=0; i < ${#orignames[*]} ; i++))
Specifically, I don't understand what this section means:
Quote:
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
Quote:
i++
means add 1 to the variable 'i' each time the loop runs. Is that correct?
 
Old 02-24-2010, 01:46 PM   #17
pixellany
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, 02:52 PM   #18
lt1776
LQ Newbie
 
Registered: Feb 2010
Posts: 13

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

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


Reply


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 10:58 PM
renaming multiple files yanchina12 Linux - Newbie 5 12-21-2007 08:56 AM
Combine multiple one column text file into one text file with multiple colum khairilthegreat Linux - Newbie 7 11-23-2007 02:31 PM
Steps needed to convert multiple text files into one master text file jamtech Programming 5 10-08-2007 12:24 AM
Renaming multiple files ajcns Linux - Newbie 2 01-20-2007 12:04 AM


All times are GMT -5. The time now is 06:28 PM.

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