Re: Syntax



Cameron Laird wrote:
In article <1190998986.136312.167350@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<mohitanchlia@xxxxxxxxx> wrote:
I can't find good tutorial about syntax of / %.

In expect script I am trying to do something like this:

set size [file size $tp_receive_to_path]
# Now check if it return 0
if { $size mod 72 != 0 } {
# receive file! Retry
send -s -- "get $tp_receive_to_tmppath
$tp_receive_to_path\r"
}

Is syntax of if and mod correct ?


I think what you first want is

if [expr $size % 72] {...

Eventually you'll write this as

if {0 != [expr $size % 72]} {...

Cameron, you've been writing too much C lately. :-)

if {$size % 72 != 0} {...



--
Bryan Oakley
http://www.tclscripting.com
.



Relevant Pages

  • Re: Getting the word to conventional programmers
    ... claird@lairds.us (Cameron Laird) writes: ... Once I did the script and it started I had to ... > Bleah. ... Bruce, or someone, is it handy for you to help verify what's ...
    (comp.lang.tcl)
  • Re: Services trouble!!!
    ... You could also use the features in the /etc/dhclien.conf script to overwrite ... timeout 60; ... retry 60; ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Odd cron-related problem.
    ... Cameron Laird wrote: ... Never mind. ... My error was in typing the message, ... adding the following lines to the top of your script will give you your answer: ...
    (comp.lang.tcl)
  • Re: iptables script absent in Sarge?
    ... > (this is a retry, my earlier post seems not have made it to the list) ... looking for the wrong script name? ... > iptables but couldn't get the scripts that run on startup. ...
    (Debian-User)
  • Re: Expect... need script to extract middle portion of output
    ... > claird@lairds.us (Cameron Laird) writes: ... >> I'm certain what you're trying to accomplish is easy. ... > from the spawned process, i.e., before doing any matching. ... cannot peek inside the expect script and learn what they are. ...
    (comp.lang.tcl)