http://qs321.pair.com?node_id=189641


in reply to Returning from a program

If kshell supports the same kind of shell variable assignments that are typical in (ba)sh, then something like this ought to work:

The perl script simply prints the name of the selected file to stdout, terminated by a line-feed.

The perl script is invoked from kshell using backticks, in a construct like the following:

ENV_FILE=`selection_script.perl` setup_env ENV_FILE

Unlike the perl backtick operator, the use of backticks in (ba)sh returns the output of the command with all line-feeds converted to spaces.

update: revised the shell script to reflect the example given by peschkaj.