RUNBLOCK(1)

NAME
runblock - execute an execline-block(7)

SYNOPSIS
runblock [-P] [-n argshift] [-r] n cmd...

DESCRIPTION
runblock' s purpose is to help you write execline commands in the execline language. It can only be used inside an execline script. If the script has been given blocks as arguments, runblock allows you to execute one of the blocks individually. It also allows you to give those blocks as a set of arguments to another command.

runblock skips the first argshift positional parameters. It does that to allow you to design commands that take simple arguments and blocks.

Then runblock looks for and parses blocks ( cf. execline-block(7)) in the positional parameters.

If the -r option is present: runblock skips n blocks and execs into the remaining arguments.

Else it skips n -1 blocks and execs into the n th one.

If cmd... is not empty, then instead of directly executing the block or the remainder, runblock appends the selected set of arguments to the cmd... command line.

Normally runblock pops ( cf. execline-pushenv(7)) its environment frame before executing. If the -P option has been given, it does not pop.

Of course, if the block structure doesn't match, runblock exits 100 with an error message.

  Credits
The runblock idea, as well as the ifelse(1) idea, comes from Paul Jarc[1].

EXAMPLES
Suppose that we want to implement the ifelse(1) command as an execline script, using the ifte(1) command. runblock allows us to do it in a simple way:

    #!/command/execlineb
    ifte { runblock 2 } { runblock -r 2 } runblock 1

That's it.

SEE ALSO
background(1), backtick(1), foreground(1), if(1), ifelse(1), ifte(1), ifthenelse(1), pipeline(1)

[1] https://code.dogmap.org/

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/runblock.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)