All Questions
Tagged with bash environment-variables
209
questions
0
votes
1
answer
2k
views
Where to set env var for Debian12?
There are too many places can hold permanent env var settings in Linux, so that I can't finger out which one is the most correct/proper.
/etc/environments
/etc/bash.bashrc
/etc/profile
/etc/profile.d/...
-1
votes
1
answer
443
views
Set Variable to ls command output
I'd like to create a variable from the output of a bash command. How does one create a variable out of the output of the command "ls /Users".
Variable creation does not work in this case:
...
1
vote
1
answer
65
views
Bash terminals launched from windows UI have an invalid `!::=::\` variable set
When I run printenv one of the returned variables is !::=::\. I noticed that the variable exists because docker does not work correctly with it set.
$ printenv | grep ::
!::=::\
$ docker stack deploy ...
1
vote
1
answer
574
views
Expand variable to alias and execute
I have an alias set in my .bash_aliases file to execute neovim.
I can successfully use this alias from the command line however I cannot use this alias via a variable (ie the EDITOR variable - set in ....
0
votes
1
answer
1k
views
How to start tmux session that overrides environment variables set in .bash_profile?
Suppose I have an environment variable set inside .bash_profile: export ABC=from_bash_profile.
$ echo $ABC
from_bash_profile
When I try to create a new tmux session with environment variables for ...
0
votes
1
answer
931
views
Securing username and password passed as Environment variable
Username and Password are passed as plain text as environment variable while running a bash script from a existing process. using following command.
sudo -u someuser USERNAME=abc PASSWORD=xyz /path/to/...
1
vote
0
answers
473
views
Environment Variable not showing up
I am implementing public private key based authentication and I need to parameters the location where I store my keys. So that, programmatically my jobs can read it from this location and establish ...
0
votes
2
answers
4k
views
Setting environment variables in bash script doesn't work?
If I run this on the command line, it will make the commit be at the specified date:
THE_TIME='2022-01-01T22:50:12 -0700' GIT_AUTHOR_DATE=$THE_TIME GIT_COMMITTER_DATE=$THE_TIME git commit -am 'commit'
...
0
votes
0
answers
1k
views
How to copy file of env variable to another file
I am executing bash commands inside a yaml file. I have set an env variable SECRET which point to a yaml file in my home directory, and I want to copy the content of this yaml file to another file, as ...
0
votes
2
answers
1k
views
Setting environment variables using eval - by calling other shell script
I have two shell scripts Caller and getGlobalParameters.
There is a function defined in the getGlobalParameters script which calls a java class and uses the values returned by the java class to set ...
1
vote
1
answer
60
views
How to add environment variables to "mdkir -p" bash command?
Lets say I have an environment variable var="html,xhtml". I want to create a directory with subfolders, like so:
mkdir -p Website/{static/{cs,js},templates/{html,xhtml}}
How can I replace {...
0
votes
1
answer
6k
views
Load ENV file from bash script
I have a bash script that has the following content :
#!/bin/bash
source ./django.dev.env
docker compose --env-file ./uvicorn.dev.env -f ./docker-compose.yaml
and a django.dev.env file with the ...
0
votes
2
answers
503
views
How to find where the variable come from in a bash set command?
It happens I have some unwanted environment variable inside the set command output, and I can't get rid of these:
$ set
ALL_PROXY=socks://127.0.0.1:10010/
.... (lots of environment variables)
...
1
vote
3
answers
1k
views
BASH Loop Through Variables
If i have a bunch of variables in bash, like this:
foo_1="path/1"
foo_2="path/2"
foo_3="path/3"
foo_4="path/4"
foo_5="path/5"
They all start with ...
6
votes
2
answers
6k
views
Assign result of conditional expression to environment variable
I'd like to store the result of a conditional expression in an environment variable.
I tried:
C=$([ "$A" = "$B" ])
but the value of $C after running that is an empty string.
I ...