Project xenv
xenv
* Fix interation between macros and loops.
Xenv is a text preprocessor. It reads input from files (or the standard input, if none are supplied) and prints it on the standard output, replacing references to environment variables with their actual values. Variables are referenced using POSIX-compatible shell syntax: $NAME
, ${NAME}
, ${NAME:-word}
, ${NAME+=word}
, ${NAME:=word}
, ${NAME:?word}
. A special ternary construct is provided: ${NAME:|word1|word2}
, which substitutes the expansion of word1 if NAME is set and the expansion of word2 otherwise. Preprocessor directives provide support for inclusion of external files, conditional text expansion (depending on the value of an environment variable or exit code of an external command), diversions, for and foreach loops etc.