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]...
i figured it out.
append just cancatinates.
example
set bootsection1 "newsstuff boot -z -elf peter.kernel: /' newstuff"
set bootsection2 "root=/dev/mtdblock3 rootfstype=squashfs resmem=75m@155m(cdi) resmem=26m@230m(grmem)\""
append bootsection1 $bootsection2
append bootsection1 "\""
#you...
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...
thanks.
i had a little trouble understanding. can you maybe put terms in, like actual strings please. like s is the string below, but what about s2?
the string i will be grabbing is along these lines:
"boot -z "squash" "/home/David/"
questions.
one of the lines that i pull has special characters, the ".
i know to mask them i precede them with a \.
how do i write script to pull the string in, insert \ in front of " it sees.
david
basically
if
switch
switch
this is the code and the errors i am getting.
code
+++++++++++++++++++++++++++++++++++++++++++++
set brand 100
set version 1200
set name "hr20"
puts "Version is $version\n"
if {$version <1300} {
#standard...
Gentlemen
I have strings with special characters in them " to be exact.
how do i get the string to record correctly at a "set" "send" "put" statment
#this did not work, the quotes screwed it up.
set bootline "boot -elf -z $tftpserver:machine1-pac.initrd "root=/dev/ram0 rootfs=xxx calmem=88m"
I got an interesting result here.
the nested if worked fine when i put numbers in. when i put a letter in, i expected it to go to the else(non-standard case i presumed) for some reason it went to the ifelse statement.
#!/usr/bin/expect -f
set version "x"
send "Version is $version\n"...
i figured it out.
its \ after each case, except the default.
the syntax in a number of online guides and exploring expect book was wrong.
#!/usr/bin/expect -f
#case statement syntax
set name "david"
#send "The name is $name\n"
#expect "cfe> "...
i am not having success with a proof of concept case statement.
This simple program does not like the "switch" line
i tried:
switch -glob $name
switch -- $name
switch $name
switch name
among others.
if you see what is causing the hangup, pleas let me know.
david
#!/usr/bin/expect -f
#case...
i need to do a classic case statement, i wanted some suggestions of how to implement it.
my pseudocode is like this:
if version is 1200 or below, then
{
machine1, use this line
machine2, use this line
machine3, use this line
... 6 unique machines like that.
}
else
#if buld is more...
additional puzzle i have facing me is: putting a string together from stuff i pulled out.
specific example:
i got this line i am pulling out: # buildroot_tag: buildroot_dev_dtvdev_v3b0044_20110815_dtvcm
i use buildroot: to signal start, and what i need to pull out is...
have you seen my code? nothing is obvious. :)
your sting works.
it does exactly what ineed it to, but i am not sure how it does it, and i need to understand it to use it again.
it looks like "set i [string... identifies the marker where needed information is, and where it begins"root. Can you...
with a little correction i was able to get this output:
6
entire text file written afterwards
it looks like "read" argument has the line number and set variable "a" has the entire file.
the files that i plan to read are like 20 pages. i wonder how safe it will be to run a program openning...
i am working on openning the file... so i can run the code thacoda wrote.
program runs, but did not figure out what it actually does.
----
#!/usr/bin/expect -f
#runline expect /home/david/Desktop/monday3.sh
send " we are going to open up a file for reading, ok? \n"
expect "ok"
set...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.