This tag is misspelled. variable-substitution is correct. `t` is missing. This is the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders are replaced with their corresponding values.
Questions tagged [variable-substitution]
74 questions
2
votes
2 answers
Is there an equivalent to <(process list) for variables?
I can use <(some command) in place of a file, but how can I achieve the equivalent with a variable? I'm using the paste command, which expects files as arguments, and want to use the contents of SOMEVAR as though it were a file.
paste…

Matt Joiner
- 112,946
- 110
- 377
- 526
2
votes
1 answer
Bash Variables - Define Multiple Possible Expected Values
Apologies if this has been answered previously, but I couldn't find much online.
Here's what I'm trying to accomplish:
if [[ "${hostname}" = (foo | bar)servername(01 | 02 | 03) ]]; then var="foobarfoo"
fi
With this any of the following would meet…

Tronyx
- 29
- 6
2
votes
2 answers
combining tilde expansion with variable substitution in bash
Say I'm running bash as root, and I want to chown the home directory of a user ada. Say also that ada is stored in a variable called $USER (because I'm doing this from a script).
When I tried the following,
chown -R $USER:$USER ~$USER
the shell…

Chris Middleton
- 5,654
- 5
- 31
- 68
2
votes
2 answers
Can someone explain/give a breakdown of this shell parameter substitution? ${cfg+-f "$cfg"}
I was looking for a good workaround for keeping my .tmux.conf file consistent across systems (I have both OS X and Ubuntu and they have different techniques for copy/paste support) when I came across this comment that offered a solution:…

3cheesewheel
- 9,133
- 9
- 39
- 59
2
votes
2 answers
Ruby variable subsitution in method call
Ruby noob here. Any help with a little issue I'm having would be appreciated.
I am trying to place an array into a connection string argument which is formatted as an array.
My array is as follows:
hosts =…

Mr G
- 23
- 3
1
vote
1 answer
how to interpolate recursive search in zsh
I want to use an environment variable in a command with recursive search.
export RAILS_FILE_EXTENSIONS='(erb|feature|haml|jrxml|js|rake|rb|rxml|scss|xml|yml)'
ls **/*.${RAILS_FILE_EXTENSIONS}
It does not work this way. How should it look like?

Apis Mellifera
- 15
- 2
1
vote
1 answer
File-transform-task in Azure DevOps release-pipeline not substituting variables
In my project, there is a Webservice.settings containing 3 variables. (Structure of Webservice.settings)
I intent to set these variables with my release-pipeline (Azure DevOps). Therefore, I created a variable-group in DevOps, containig the…

Nepomuk
- 21
- 4
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
Azure DevOps Pipeline Json Variable Substitution - Ocelot.json
I have the following file ocelot.json and I want to change the Host object of each route configured inside the file through a variable. I want to change the localhost to the correct hostname through a variable.
"Routes": [
//Parámetricas
{
…

camilo-cajamarca
- 11
- 1
1
vote
2 answers
Is there a parameter substitution syntax for file or directory existence?
I would like to use parameter substitution to compute a path based on
a variable being defined
a first default directory to be used if it exists
a file inside the $HOME directory to be used if neither of 1 or 2 are available.
The variable (#1) and…

iconoclast
- 21,213
- 15
- 102
- 138
1
vote
1 answer
Variable Substiution in sed executing via python
Below is my sed command:
sed "s/N([0-9]*)/sum('\1')/g" old.txt > new.txt
works fine in bash terminal
But below python code doesnot execute :-
file1=old.txt
file2.new.txt
sed_cmd = 'sed "s/0x\([0-9]*\)/sum('\1')/g" %s > %s' %(file1,file2)
I get…

HDev007
- 325
- 2
- 6
- 15
1
vote
1 answer
Simple configuration files template processor that preserves bash-style variables
I have to introduce some templating over text configuration files (yaml, xml, json) that already contain bash-like syntax variables. I need to preserve existing bash-like variables untouched but substitute my ones. List is dynamic, variables should…

Roman Nikitchenko
- 12,800
- 7
- 74
- 110
1
vote
0 answers
Transformation / Substitution of configuration files in AWS CodePipeline
Finally getting into AWS after several years in Azure.
I have a CodePipeline set-up for a dotnet core lambda function.
Traditionally I have set-up build pipelines and then transformed the configuration files for each release stage. Azure has an…

JDBennett
- 1,323
- 17
- 45
1
vote
2 answers
Substitute variable as an input from the STDOUT of a console application
In our release pipeline, we have a console app that performs a function which generates an encryption key and outputs it to STDOUT. We need to be able to use this value in a variable during deployment (updating a configuration file with the results…

Dean Selley
- 23
- 2
1
vote
1 answer
Separating yaml files and passing in variables
Is there any way to separate a YAML file and pass in variables to sub files?
For Example:
Parent yaml file:
Fn::Merge:
- !Include /templates/first.yaml, variables: {env: staging}
- !Include /templates/second.yaml, variables: {env:…

John David
- 111
- 1
- 1
- 4