Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

expect script - simple proc function

Status
Not open for further replies.

davidbelarus

Programmer
Oct 21, 2011
26
0
0
US
Gentlemen

i am converting my code to use proc and as proof of concept making basic proc functions:

this code gives this error: wrong # args: should be "printer a b c"
while executing
"printer { $brand $version $name }"


+++++code+++++
#!/usr/bin/expect -f

set brand 100
set version 1200
set name "hr20"

proc printer {a b c } {
puts "$a $b $c"}

printer { $brand $version $name }
 
made progress.

a few that work:

#taken from online example
proc printArguments args {
foreach arg $args {
puts $arg
}
}
set david "good person"
printArguments 1 2 3 $david

+++++++++++++++++++++++++++++

proc printer {a b c } {
puts "$a $b $c"
}

#set sum [plus $num1 $num2]
printer 1 2 3

+++++++++++++++++++++++++++++

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top