Envsubst

From NovaOrdis Knowledge Base
Revision as of 10:08, 2 January 2021 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

envsubst performs environment variable expansion in shell-format strings in arbitrary files. No other shell command line expansions will be. performed. If a variable is declared but not found in the environment, it will be replaced with the empty string.

cat file.txt | envsubst > file-with-variables-expanded.txt

Installation

Mac

brew install gettext

then modify .bashrc:

 export PATH=/usr/local/opt/gettext/bin:${PATH}

RedHat/Centos

yum install -y gettext