increment variable, how to
 
Post new topic   Reply to topic    Hawkee.com Forum Index -> TCL Scripting
 
onedreamcloser  -  Sun Feb 05, 2012 4:14 am Reply with quote
Hello All,

What I would like to ask you is, why the following snippet does NOT increment the variable $times ?

#!/usr/bin/tclsh

set logging {
LC/0/1/CPU0:Jan 27 08:24:17.014 CET: ifmgr[175]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/1/0/33, changed state to Down
LC/0/1/CPU0:Jan 27 08:24:17.014 CET: ifmgr[175]: %PKT_INFRA-LINEPROTO-5-UPDOWN : Line protocol on Interface GigabitEthernet0/1/0/33, changed state to Down
} ;
set times 0 ;
set records [ split $logging "\n" ]
foreach rec $records {
puts $rec ;
incr $times 1 ;
puts $times ; # puts [ incr $times 1 ; ] ;
}

Many Thanks.
Johannes13  -  Mon Feb 27, 2012 6:22 am Reply with quote
Remove the $ in incr $times 1
so it becomes incr times 1
Display posts from previous:   
Post new topic   Reply to topic    Hawkee.com Forum Index -> TCL Scripting All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.