\begin{page}{HTXLinkPage5}{Linking to Unix} \centerline{\fbox{{\tt \thispage}}}\newline \begin{scroll} Let us conclude the tour of \HyperName{} actions that can be triggered with a click of a button with two more facilities. These are \beginImportant \table{ { {\tt \\unixcommand\{{\it trigger text}\}\{{\it unix command}\}}} { {\tt \\unixlink\{{\it trigger text}\}\{{\it unix command}\}}} } \endImportant The first one, {\tt \\unixcommand}, is very much like {\tt \\axiomcommand} and {\tt \\lispcommand}. The trigger text becomes an active area. Clicking on it will force \HyperName{} to pass the second argument to the system as a shell command to be executed. The shell used is {\bf /bin/sh}. \HyperName{} ignores the output of the command. \beginImportant \begin{paste}{HTXLinkPage5xPaste1}{HTXLinkPage5xPatch1} \pastebutton{HTXLinkPage5xPaste1}{Interpret} \newline {\tt \\unixcommand\{List \\\$HOME directory\}\{ls \\\$HOME\}}\newline \end{paste} \endImportant The {\tt \\unixlink} command delegates to a another program the creation of a dynamic page. When the trigger text is activated, \HyperName{} will invoke the command specified in the second argument. It will then start reading the {\it standard output} of the command until a complete page has been received. It is important that a single page and nothing more is written by the command. This command is essentially a {\tt \\downlink}, i.e. the new page replaces the current page in the window. There aren't any other flavours of {\tt \\unixlink}. A trivial example is to use {\bf cat} on a \HyperName{} file known to contain just one page. \beginImportant \begin{paste}{HTXLinkPage5xPaste2}{HTXLinkPage5xPatch2} \pastebutton{HTXLinkPage5xPaste2}{Interpret} \newline {\tt \\unixlink\{Some file\}} \newline {\tt \{cat\\ \\env\{AXIOM\}/doc/hypertex/pages/HTXplay.ht\}} \end{paste} \endImportant Two things to notice in the second argument of {\tt \\unixlink}: You must use a {\it hard space} {\tt '\\\ '} to preserve the spacing in the command. Also, the {\tt \\env} command allows you to use an environment variable in \HyperName{} text. With a little ingenuity (and maybe some shell and {\bf awk} scripts !) , one can use these facilities to create, say, a point-and-click directory viewer which allows you to edit a file by clicking on its name. \end{scroll} \beginmenu \menulink{Next -- How to use your pages with \HyperName{}}{HTXLinkPage6} \endmenu \end{page} \begin{patch}{HTXLinkPage5xPatch1} \begin{paste}{HTXLinkPage5xPaste1A}{HTXLinkPage5xPatch1A} \pastebutton{HTXLinkPage5xPaste1A}{Source} \newline \unixcommand{List \$HOME directory}{ls \$HOME} \end{paste} \end{patch} \begin{patch}{HTXLinkPage5xPatch1A} \begin{paste}{HTXLinkPage5xPaste1B}{HTXLinkPage5xPatch1} \pastebutton{HTXLinkPage5xPaste1B}{Interpret} \newline {\tt \\unixcommand\{List \\\$HOME directory\}\{ls \\\$HOME\}}\newline \end{paste} \end{patch} \begin{patch}{HTXLinkPage5xPatch2} \begin{paste}{HTXLinkPage5xPaste2A}{HTXLinkPage5xPatch2A} \pastebutton{HTXLinkPage5xPaste2A}{Source} \newline \unixlink{Some file} {cat\ \env{AXIOM}/doc/hypertex/pages/HTXplay.ht} \end{paste} \end{patch} \begin{patch}{HTXLinkPage5xPatch2A} \begin{paste}{HTXLinkPage5xPaste2B}{HTXLinkPage5xPatch2} \pastebutton{HTXLinkPage5xPaste2B}{Interpret} \newline {\tt \\unixlink\{Some file\}} \newline {\tt \{cat\\ \\env\{AXIOM\}/doc/hypertex/pages/HTXplay.ht\}} \end{paste} \end{patch}