Tool to expand environment variables in nypatchy cradles
yexpand inputfile [ outputfile ]
yexpand is a very simple script to expand environment variables in a text file to their current values in the shell environment. It was written to be used with nypatchy cradles. It is recommended you not try to use it for any other purposes (note BUGS below).
yexpand takes inputfile as input, replaces all instances of shell variables (in the form $VARIABLE or ${VARIABLE}) with their current values in the environment, and saves the result to outputfile. Undefined variables are replaced with the empty string. If outputfile is not given, the result is instead saved to the current directory as a file of the same name as inputfile. Thus an input file in the current directory will be overwritten.
This script is very simple-minded. Since it basically just echos its input file as a here-doc, it will attempt to perform all types of shell substitution (command substitution, etc.) as well as variable substitution. Hence it is likely to fail on anything except the very simplest text files.
Additionally, this script creates a temporary file. The file is created in the current directory, so there should not be security implications. However, any existing file named file.yexp (where file is the basename of inputfile) in the current directory will be overwritten and then deleted.
fcasplit(1), nycheck(1), nydiff(1), nyindex(1), nylist(1), nymerge(1), nypatchy(1), nyshell(1), nysynopt(1), nytidy(1)
The reference manual for the Nypatchy suite of programs is available in compressed PostScript format at the following URL:
http://wwwasdoc.web.cern.ch/wwwasdoc/psdir/p5refman.ps.gz
This manual page was written by Kevin McCarty <[email protected]> for the Debian GNU/Linux system (but may be used by others). It is licensed under the GNU General Public License, version 2 or later (at your choice).
Copyright (C) Kevin B. McCarty, 2008.