Questions tagged [envsubst]
20 questions
77
votes
12 answers
is there an escape character for envsubst?
Is there a way to prevent envsubst from substituting a $VARIABLE? For example, I would expect something like:
export THIS=THAT
echo "dont substitute \\\$THIS" | envsubst
and have it return
dont substitute $THIS
but instead I get
dont substitute…

quinn
- 5,508
- 10
- 34
- 54
7
votes
2 answers
Substitute environment variable in all files when kubectl apply-ing
Let's say we have a number of Kubernetes configuration files in a folder kubernetes and we want to apply them all:
kubectl apply -f kubernetes -n MyNamespace
Some of these files contain environment variables which need to be substituted first (no…

Max
- 9,220
- 10
- 51
- 83
5
votes
1 answer
Cannot use `$$` character in GitLab environment variables
Cannot use $$ character in environment variables of GitLab CI.
I store my secrects in GitLab CI environment variables out of which one of my pass word string has $$ characters at the end (eg :Ab1ab$$). When i echo it out or use envsubst, the output…

maddie
- 505
- 1
- 6
- 13
4
votes
1 answer
Why is my envsubst command just inserting blank strings?
I'm trying to run the command envsubst < myfile to replace environment variables but instead of being replaced with their values, they are being replaced with blank strings.
Here's my example command (split onto separate lines for…

apbarratt
- 615
- 9
- 18
1
vote
1 answer
envsubst: argument list too long
I have an exported variable and a template file. But when I use envsubst, I get the error argument list too long.
I use envsubst (GNU gettext-runtime) 0.21.1
The problem seems to come from the size of this exported variable, it is 131713 characters…

Iglou.eu
- 11
- 3
1
vote
2 answers
Environment variables substitution in C
I have a string with the following content (UTF-8):
__$FOO ${FOO} ${FOO:def} ${FOO2:-тест}
And environment variable FOO with a value test. My C application should work like a GNU envsubs - replace all $FOO or ${FOO} entries with a test - nothing…

Paramtamtаm
- 312
- 5
- 12
1
vote
1 answer
Updating variables by reference in bash script?
Is it possible to use a variable by reference in bash scripting in the way it is done in C++?
Lets say I have a script like below:
#!/bin/bash
A="say"
B=$A
echo "B is $B"
A="say it"
echo "B is $B" # This does not get the new value of A but is it…

TheWaterProgrammer
- 7,055
- 12
- 70
- 159
1
vote
0 answers
How to avoid eval console output or logs (contain secrets) in shell script when you read file lines?
Probably a small shell script problem:
I am trying to avoid printing secret values to console output or logs. I have to read a file line by line, then replace any variable values in every line and write output to a new file.
Here is my code to read…

unawaz
- 69
- 1
- 6
1
vote
1 answer
Usage of envsubst combined with tee randomly results in an empty file
I'm looking to understand what is going on in a simple script, that seems to produce random results.
What I am trying to do:
Replace variables in pre-existing files from the values defined in the environment.
This is done inside a Docker container…
user11578494
1
vote
1 answer
envsubst works only for part of the variables
I have a file with some $VARIABLES which I want to substitute using envsubst tool. But in my case the tool is substituting only +/- half of the variables.
To illustrate:
I have a file .env with some…

baant
- 153
- 2
- 13
0
votes
2 answers
envsubst within docker using build-arg
Is it possible to use envsubst with build-arg during build time of the docker image ? I have a following scenario:
FROM alpine as substitutor
ARG ROOT_PWD
RUN apk add --no-cache envsubst
WORKDIR /app
COPY ./myfile.json .
RUN export…

Branislav B.
- 509
- 7
- 21
0
votes
1 answer
How to have one line string when passing in values using envsubst command?
When using envsubst to replace values in a file, it creates a newline when it appends to a string. How do I prevent it from inserting a newline when saving it to a new file?
Environment…

Duke
- 1
- 1
0
votes
0 answers
Update Task Definition for ECS Fargate
I have an ECS Fargate cluster that is being deployed to through BitBucket Pipelines. I have my docker image being stored in ECR. Within BitBucket pipelines I am utilizing pipes in order to push my docker image to ECR and a second pipe to deploy to…

Dave Michaels
- 847
- 1
- 19
- 51
0
votes
2 answers
Using envsubst for a Meteor app with bitbucket pipelines
I have the following bitbucket pipeline, which is for deploying a Meteor app with Mup.
Everything is working up until the final mup deploy command it seems to not to be able to read the generated config.json file that is supposed to have my secure…

Anders Kitson
- 1,413
- 6
- 38
- 98
0
votes
1 answer
unix envsubst not picking local environment variables inside docker
I've for a standard linux docker container that sets some environment variable E1=60 and installs a file myfile which is simply the line:
this is ${E1}
then runs the following script at container startup time:
#!/bin/sh
E1=80
export E1=80
cat…

Sagi Mann
- 2,967
- 6
- 39
- 72