# eval Change the behaviour of a set of commands
Usage
    eval [-q] [-r=<window>] <command>
Description
This command is useful to execute variable command sequences. <command> is first evaluated as a normal parameter (thus identifiers and variables are substituted) then the evaluated string is executed as a command sequence. -q causes eval to run quietly and don't display any errors in the inner command. -f causes eval to ignore the errors inside <command> and continue execution. This command may be used to rebind the <command> to a specified window. <command> shares the local variables with this command scope so you can easily exchange data with it. Remember that <command> is still a normal parameter and it must be enclosed in quotes if youwant it to be a complex command sequence. eval propagates the <command> return value.
Switches
-q | --quiet
Disable any error output
-f | --force
Continue execution even if <command> fails with an error
Syntax Specification
    eval [-q] [-r=<window>] <command>
Examples
        # evaluate a variable command
        if(%somecondition)%tmp = "echo yeah"
        else %tmp = "echo -i=10 yeah"
        eval %tmp
        # Rebind the command to the #linux channel to get the user list
        eval -r=$channel(#linux) "%Nicks[]=$chan.array;"
        # A nice alias that allows iterating commands through all the consoles
        # This is by LatinSuD :)
        alias(iterate)
        {
            %ctxt[]=$window.list(console,all)
            for(%i=0;%i<%ctxt[]#;%i++)
            {
                eval -r=%ctxt[%i] $0-
            }
        }
        iterate echo Hi ppl! :)
        # A little bit shorter (but less "colorful") version might be...
        alias(iterate)
        {
            foreach(%x,$window.list(console,all))
                    eval -r=%x $0-;
        }
        iterate echo Hi again!
        # Evaluate a command block
        eval "{ echo First command!; echo Second command!; }"
See also
$escape

Index, Commands

KVIrc 4.0.4.4744 Documentation
Generated by kerd at Fri Mar 25 20:00:07 2011