LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 01-26-2011, 07:54 AM   #1
bino25
Member
 
Registered: Dec 2010
Posts: 50

Rep: Reputation: 11
help understanding ksh script


So there is a segment of a ksh script on our server that does this:

for LINE in `cat ${TMPFILE}`
do
enable ${LINE}
((COUNT+=1))
done

I know what the "for/do" does, but what does the "COUNT+=1" do? And yes, I am new to linux and scripting.

Thanks
 
Old 01-26-2011, 08:03 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
It simply adds 1 to the current value of COUNT. In other words it increments the value of COUNT by 1 at each loop. There are similar operators, like -= or /=. Here is the full list.
 
Old 01-26-2011, 08:16 AM   #3
bino25
Member
 
Registered: Dec 2010
Posts: 50

Original Poster
Rep: Reputation: 11
Thanks colucix. That helped a lot and I now understand the remaining part of the script!!!
 
  


Reply



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
[SOLVED] KSH script cheltz Linux - Newbie 12 05-21-2010 03:57 PM
Ksh Script Help sharathkv25 Programming 10 02-02-2007 10:28 AM
help w/ksh script ShaqDiesel Programming 2 01-12-2007 02:04 PM
Can somebody help me with a ksh script? twentymil AIX 7 01-21-2004 09:55 AM
KSH script AquamaN Programming 2 12-08-2003 11:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:07 AM.

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
Open Source Consulting | Domain Registration