#echo

You can use the #echo directive to reference environment variables.

For example, suppose you have set the environment variable $cat (for "category") in a high-level web page specification file:

#set cat = "Reference"

...

#include <files/pikt/doc_page_top_files.cfg>

...
You could then reference the value of the $cat environment variable in the doc_page_top_files.cfg file in this way:
#echo "	=h1($cat)"
In any of the config files, you may reference an environment variable specified in an earlier #set or #setenv directive in this way:
#include [/bin/echo "$foo"]
which would have the same effect as the line
bar
assuming you had set foo equal to "bar" in an earlier #set or #setenv directive.

Alternatively, you could use the #echo directive:

#echo "$foo"
This would be useful to achieve a form of crude parameter passing to #include files.

Returning to the web pages example, suppose you have a common header #include file that is mainly identical across all of your pages except for a few details, such as the page title.  If you set the environment variable $title with the directive

#set title = "ACME Widgets: Product Information"
you may subsequently reference $title in the header #include file with the directive
#echo "<title>$title</title>"
After all preprocessing, the line would effectively be
<title>ACME Widgets: Product Information</title>
See the pikt.org website for demonstrations of this advanced technique.

prev page 1st page next page
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
runaway processes
Pikt script