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!

Search results for query: *

  1. davidbelarus

    expect script - simple proc function

    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]...
  2. davidbelarus

    expect script - cancatinate a string

    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...
  3. davidbelarus

    expect script - cancatinate a string

    i got a string "A" and i want to add string "B" to end of it. This will make a full command line i can place on minicom prompt.
  4. davidbelarus

    expect script - simple proc function

    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...
  5. davidbelarus

    expect script - automation to insert \ before "

    thanks. that makes sense
  6. davidbelarus

    expect script - automation to insert \ before "

    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/"
  7. davidbelarus

    expect script - automation to insert \ before "

    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
  8. davidbelarus

    expect script - masking quotes "

    i know the answer to this. use \ before the " example set value " \" coolbeans \" by the way, what do i get for helping someone out like that? david
  9. davidbelarus

    nested if, with a nested switch, which has another nested switch

    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...
  10. davidbelarus

    expect script - searching a text file

    thanks thacoda
  11. davidbelarus

    expect script - masking quotes &quot;

    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"
  12. davidbelarus

    expect script - nested if-ifelse-else

    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"...
  13. davidbelarus

    expect script - nested loop or case type statement.

    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> "...
  14. davidbelarus

    expect script - nested loop or case type statement.

    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...
  15. davidbelarus

    expect script - nested loop or case type statement.

    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...
  16. davidbelarus

    expect script - searching a directory

    i spent all my time with the other code today. i will revisit this tomorrow. thanks again for giving me something to work with.
  17. davidbelarus

    expect script - searching a text file

    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...
  18. davidbelarus

    expect script - searching a text file

    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...
  19. davidbelarus

    expect script - searching a text file

    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...
  20. davidbelarus

    expect script - searching a text file

    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...

Part and Inventory Search

Back
Top