Previous: , Up: Commanding poke   [Contents][Index]

1.4.5 Scripts

Following the example of Guile Scheme, the Poke syntax includes support for multi-line comments using the #! and !# delimiters. This, along with the -L command line option, allows to write Poke scripts and execute them in the command line like if they were normal programs. Example of a script:

#!/usr/bin/poke -L

print "Hello world!\n";

The resulting script can process command-line options by accessing the argv array. The following Poke script prints its arguments:

#!/usr/bin/poke -L

for (arg in argv)
  printf ("Argument: %s\n", arg);

If you want to pass additional flags to the poke command, you need to use a slightly different kind of shebang:

#!/usr/bin/env sh
exec poke -L "$0" "$@"

load elf;
printf ("%v\n", Elf64_Ehdr @ 0#B);