Try envsubst
FOO=foo
BAR=bar
export FOO BAR
envsubst <<EOF
FOO is $FOO
BAR is $BAR
EOF
More Related Contents:
- How to replace ${} placeholders in a text file?
- How can I pipe stderr, and not stdout?
- What is the meaning of the ${0##…} syntax with variable, braces and hash character in bash?
- Capture stdout and stderr into different variables
- Length of string in bash
- Removing colors from output
- How to loop through a directory recursively to delete files with certain extensions
- Associative arrays in Shell scripts
- How can I remove the first line of a text file using bash/sed script?
- How to get the part of a file after the first line that matches a regular expression
- Open and write data to text file using Bash?
- Send string to stdin
- Looping through alphabets in Bash
- How can I reference a file for variables using Bash?
- Why is this bash prompt acting strangely/disappearing, and how do I fix it (OS X)?
- Why is “[[ 10 < 2 ]]" true when comparing numbers in bash? [duplicate]
- Use awk to find average of a column [duplicate]
- Bash: Copy named files recursively, preserving folder structure
- Read a variable in bash with a default value
- Pipe, standard input and command line arguments in Bash
- What does “export” do in shell programming? [duplicate]
- What is the most elegant way to remove a path from the $PATH variable in Bash?
- How to bold one output text in Bash?
- Add numbers to the beginning of every line in a file
- How can I convert tabs to spaces in every file of a directory?
- Multiple commands in an alias for bash
- How to match a single quote in sed
- Casing arrow keys in bash
- Store output of sed into a variable [duplicate]
- How to loop over files in natural order in Bash?