USH.ICN

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ENVIRONMENT VARIABLES
EXAMPLES
PORTABILITY
SEE ALSO
BUGS AND LIMITATIONS
AUTHOR

NAME

ush.icn − Preprocessor for shell.icn( 1 ).

SYNOPSIS

Invoked from the command line:

ush [-s ushpath]{0:N} [infile]{0:N}

Invoked from shell.icn( 1 ):

ush [out_co-expresion]{1:1} [result_list]{1:1} [infile]{0:N}

DESCRIPTION

ush.icn is an example implementation of a preprocessor for ad hoc invocation of shell.icn( 1 ) functionality "on the fly". It is very incomplete.

At this time, ush.icn supports only two functionalities:

*

Type lines one at a time for input into shell.icn instead of reading them from a file. This is not significantly different from invoking shell.icn without a -i or -p argument.

*

"Sourcing a file as a shell.icn input script", i.e., reading a shell.icn input script from a file and sending it to an instance of shell.icn.

OPTIONS

Command Line Invocation

Zero or more input files may be specified at the end of the command line. A dash may be supplied in lieu of a file name to indicate that input should be taken from the standard input. If none are specified, ush.icn reads from the standard input.

The following switch may preceed the input files when ush.icn is invoked:

−s path

Search directory specified by path for icode and script files. This option may be repeated; alternatively, several directories may be specified by enclosing path in double quotes and separating directory names with spaces (as is done for IPATH and LPATH). If a directory name contains a space, you must both enclose path in double quotes and enclose space-containing directory names in single quotes, (e.g., −s "’/path to/one folder’ ../another_folder" ). Directories specified with the −s option are searched after the working directory and before directories specified by the USHPATH environment variable.

Invocation from Shell.icn( 1 ):

When invoked from Shell.icn( 1 ), the first argument to ush.icn must be a co-expression (i.e., the instance of Shell.icn( 1 )) and the second argument must be a list. If no third argument is specified, input is taken from the standard input

ENVIRONMENT VARIABLES

USHPATH

Space−separated directory names searched after those specified with the −s option. Enclose spaces in directory names in single quotes. USHPATH must not contain double quotes.

EXAMPLES

Suppose that test.shell and translated versions of consumer.icn and producer.icn are in

  ./dist

and suppose that ush.icn is invoked either directly with

  ush -s dist

or indirectly with

  shell -s dist -p ush

The input lines

  . test.shell
  CONS   := consumer PROD -
  PROD   := producer CONS
  @ PROD

invoke shell.icn( 1 ) first with test.shell as the input script and then with the next lines as a second script.

Execution of the above input using ush.icn should produce the same results as as executing the following input using bash( 1 )

  { cat test.shell ; cat << END
  CONS   := consumer PROD -
  PROD   := producer CONS
  @ PROD
  END
  } | shell

except

*

you don’t need bash

*

you can decide whether you want to type the remaining lines after you have seen the output that test.shell produces.

PORTABILITY

ush.icn depends on shell.icn( 1 ) which depends on Stream.icn( 3 ) which in turn depends on classes. Thus, ush.icn is compatible with Unicon but not Icon since Icon does not support classes. ush.icn is not Idol-compatible because Stream.icn and shell.icn not Idol-compatible.

SEE ALSO

Eschenlauer, Arthur C., 2006. "A Unicon Shell", The Generator, Vol. 2, No. 2, pp 3-32.

  http://www.unicon.org/generator/v2n2.pdf

Jeffery, Clinton L., 1997. The MT Icon Interpreter. (Icon Project Document 169).

  http://www.cs.arizona.edu/icon/docs/ipd169.htm

Stream.icn( 3 ), shell.icn( 1 )

BUGS AND LIMITATIONS

Infinite loops in tasks will prevent control being returned to ush.icn

If shell.icn aborts, ush.icn aborts instead of attempting to restart shell.icn.

At present, the parser for scripts is an integral part of shell.icn. Thus, there is no way to specify alternative script syntax for lines typed into ush.icn.

No protocol has yet been defined for the use of result lists.

AUTHOR

Art Eschenlauer

ush.icn is in the public domain. The freedom of its content is protected by the Lesser GNU public license, version 2.1, February 1999,

  http://www.gnu.org/licenses/lgpl.html

which means you are granted permission to use this in any way that does not limit others’ freedom to use it.