Questions tagged [environment-variables]

For questions pertaining to environment variables, a set of dynamic variables that can affect the running processes behavior and access to resources. Use this tag for questions about environment variables or questions about issues arising from the impact of setting or modifying the variables value in running processes behavior and access to resources.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 views

How to inherit XDG_SESSION_TYPE in systemd units?

My current desktop environment: Plasma Wayland. Many GUI applications can't be launched from within Emacs daemon (started by e systemd unit) unless XDG_SESSION_TYPE is set to "wayland". It's ...
user avatar
0 votes
0 answers
15 views

shared library not found even if "export LD_LIBRARY_PATH" is set

Here comes a strange question. I have a QT App and it requires some libraries. Normally, the following bash script works: #!/bin/bash export LD_LIBRARY_PATH="./libs" export QT_DEBUG_PLUGINS=...
user avatar
0 votes
1 answer
23 views

Is there a commonly used environment variable or configuration setting for enabling widespread application verbosity?

Sometimes I write scripts where I want every called application to be verbose as can be for the sake of logging. This often includes typing --verbose quite a bit. Other than the -v and equivalent --...
user avatar
  • 447
0 votes
2 answers
32 views

bash: determining whether a variable specifically exists in the environment?

In bash, I know that there are a few ways to check whether a given variable is defined and contains a value. However, I want to check whether a given variable exists in the environment, and not as ...
user avatar
  • 259
2 votes
0 answers
17 views

Scaling of icons does not work for gtkmm applications

I have a 4K display, and the correct scaling would be 3x. I have put Xft.dpi: 300 in .Xresources and GDK_SCALE=3 GDK_DPI_SCALE=-1 in /etc/environment. This can scale most applications, but the C++ ...
user avatar
1 vote
1 answer
32 views

SSH_AUTH_SOCK set to wrong value after login but there is nothing that sets it explicitly

I am using KDE on Arch Linux and I am trying to run gpg-agent in ssh-agent emulation mode as described here. I created env file ~/.config/environment.d/80_gpg_agent.conf for systemd-environmentd-...
user avatar
  • 11
0 votes
1 answer
34 views

Variable Scope in ZSH: How to access global variables from within function?

I have an ever-expanding .zshrc file that was getting out of hand so I decided to try to fix it by breaking it into modular files and sourcing each of them. This works for the most part, but I seem ...
user avatar
  • 113
4 votes
1 answer
272 views

How to unset an invalid environment variable in bash?

I'm trying to add functionality to an existing docker-entrypoint script, the creators of the image decided environment variables would have the form key.subkey=value. I didn't know it was an invalid ...
user avatar
1 vote
1 answer
45 views

Python not able to see environment variable in RHEL

The following line of code is throwing an environment variable was not found error in a RHEL8 virtual machine running in Azure: sourceKeys = os.environ.get("MY_ENV_VAR") However, when we ...
user avatar
  • 5,064
0 votes
1 answer
42 views

How to expand tab-completion for environment variables in bash?

I have an environment variable stored in my .bash_profile called $MODULES: MODULES='/var/www/html/sites/all/modules/ When I am at the bash prompt and I type cp $MOD and then press TAB to complete, ...
user avatar
  • 123
0 votes
1 answer
44 views

How to set environment variables in Linux which takes effect immediately and for everything?

I want a way to set environment variables in Linux which takes effect immediately and on everything. For example, I set up proxy: export http_proxy=127.0.0.1:42949 That takes effect immediately. But ...
user avatar
0 votes
0 answers
18 views

"make" command not found due to PATH environment error during building FFmpeg with Zsh

I tried to build FFmpeg via terminal (zsh) and encountered this error : Command 'make' is available in the following places * /bin/make * /usr/bin/make The command could not be located because '/usr/...
user avatar
1 vote
1 answer
66 views

Linux: difference between "/usr/bin/env" and "/usr/bin/strings /proc/$$/environ"

I am learning about linux and I have a question that I have encountered in one of the books I read: The following are two different ways to print out environment variables. Please describe their ...
user avatar
0 votes
1 answer
34 views

A script /etc/profile.d/{script1}.sh doesn't work correctly

cat /etc/profile.d/atlassian-plugin-sdk.sh export PATH=$PATH:/opt/atlassian/plugin-sdk/bin ls -al /etc/profile.d/atlassian-plugin-sdk.sh -rwxr-xr-x 1 root root 48 Apr 17 21:36 /etc/profile.d/...
user avatar
1 vote
1 answer
65 views

$XDG_CACHE_HOME vs. $XDG_STATE_HOME

Based on the XDG Base Directory Spacifications, $XDG_STATE_HOME should store history and log of the programs. But it is very common to see UNIX programs storing these kind of stuff at $XDG_CACHE_HOME, ...
user avatar
1 vote
2 answers
61 views

Exporting variables in a loop

I need some help with my script. I have environmental variables like these: SECRET_OF_AN_APP_dev=123 SECRET_OF_AN_APP_test=456 SECRET_OF_AN_APP_prod=789 I want to have a script that will change ...
user avatar
  • 11
0 votes
0 answers
78 views

Bash variable is empty depending on cron schedule frequency. If every 1, 5, 15, or 10 minutes, there is a value. If every 30 or top of hour, empty

I've got a cron scheduled bash script I am seeing odd behavior with. As the title says, there is a single variable that is either empty or not after the script runs depending on the cron schedule. If ...
user avatar
0 votes
1 answer
42 views

Source a script in Linux for all users logging in that echo some things

We have CENTOS 7.x Linux with bash shell. I need a some environment variables to be set and some messages involving these env vars to be echoed (a banner kind of thing, but dynamic because it's got ...
user avatar
-1 votes
2 answers
25 views

How to substitute all the paths in the envs to other path?

I have fallowing situation: All my software is installed on the /home/daniel/* path and internally refers to it. Nevertheless, when I use a network drive, the reference changes to /home/foo/daniel and ...
user avatar
0 votes
1 answer
102 views

What is the Bash equivalent to .zshenv?

I've read that .bashrc (like .zshrc) is meant only for interactive logins (and the one non-interactive exception of remote shells). But where should environment variables for Bash be placed that is (...
user avatar
  • 8,411
0 votes
0 answers
43 views

Set Environment Variables in launch.json for CUDA Debugging When Using Nsight Visual Studio Code Edition

I am developing a CUDA application in vs code and would like to debug it with cuda-gdb, which is integrated in nsight visual studio code edition as an IDE. One requirement in using nsight visual ...
user avatar
  • 145
1 vote
1 answer
38 views

Which component of linux remove filter environment variables on executing setuid program?

It's observed that when running a program having setuid bit set, it won't receive some environment variables set on the shell (bash etc.). Several environment variables which get removed this way are ...
user avatar
1 vote
2 answers
66 views

How to use an environment variable to store a flag in zsh?

I'm working with kubectl and zsh, and I would like to store the namespace flag in an environment variable. Instead of writing: kubectl get pods -n mynamespace I would like to do something like: n='-n ...
user avatar
0 votes
1 answer
26 views

Export Makefile parameter

How can I change exported value to one passed by parameter? Makefile: default_value=Default-Value export ENV_VALUE=default_value build: python3 script.py execution: $ make build python3 script....
user avatar
  • 3
0 votes
1 answer
67 views

`exec env` vs `env`

Both exec and env don't fork, see the following example: docker run --rm -it ubuntu:18.04 sh -c 'exec sleep 1 & ps -Ho pid,ppid,cmd' PID PPID CMD 1 0 sh -c exec sleep 1 & ps -Ho ...
user avatar
  • 1,039
0 votes
3 answers
88 views

How do I set an environment variables file on the command line?

I have a file .env.local that contains a set of environment variables that should be loaded when launching my shell script, is there a way to specify this file in the command line ? .env.local ...
user avatar
0 votes
0 answers
29 views

Disable Bash completion for a single environmental variable

Suppose I have an environmental variable $SAVE_DIR=/etc/ used to return to a saved directory (here /etc/) from any Bash shell. Typing cd $SAV[Tab] expands to cd $SAVE_DIR which is quite convenient. ...
user avatar
  • 101
3 votes
2 answers
278 views

How to catch all $DISPLAY variables available per user

How to get all $DISPLAY variables currently opened by a user? In general it’s :0 but if he open a new display, so another variable is set. So how to catch all the available $DISPLAY variables ...
user avatar
  • 930
0 votes
1 answer
46 views

Reasonable way to customize ( change ) an executable program's command ( name ) , in terminal

Background Using xfce4-terminal as an example, I want to run the program by just typing term. When I type which xfce4-terminal it returns /usr/bin/xfce4-terminal. So, I created a symbolic link: sudo ...
user avatar
  • 357
1 vote
1 answer
42 views

Why are environment variables being passed to sudo session and is it a concern?

I came across some readings about how allowing environment variables to be passed to root when sudoing is a security concern. This led me to check my environment to make sure I had the proper setup. I ...
user avatar
0 votes
0 answers
41 views

Bash script ignore SLURM variables [closed]

I wrote a bash script to automate qm calculations. For this i need to write an executable file .sh which can be submitted to SLURM. Unfortunately, the Script replaces the SLURM environmental variables ...
user avatar
0 votes
0 answers
19 views

How can I best track agrs in the environment without using ps?

I am working with a customer BusyBox v1.23.2 container, trying to track args being passed in the environment. I wanted to use pslogger to show when foo is sent in the environment. However, the ps tool ...
user avatar
0 votes
1 answer
48 views

Refer variable in script file from child process [duplicate]

There is a.sh: #!/bin/bash foo=':bar baz:' declare varvar=aaaaaa export xyz=abc echo "$foo ok" hoge=huga env piyo=alice bash -i Run ./a.sh (| is cursor, > is prompt): :bar baz: ok > ...
user avatar
  • 173
0 votes
1 answer
50 views

preserve environmental variables with find -exec

Is it possible to preserve environmental variables with find -exec? I don't see any options using the FreeBSD version of find. I can switch to a for loop if absolutely required, but was hoping to ...
user avatar
  • 1,122
0 votes
1 answer
71 views

How to export a list of IP addresses as a single local variable?

In Django, one has to specify the environment variable ALLOWED_HOSTS to define a list of server's IP addresses that are allowed to host a Django website. For example: ALLOWED_HOSTS=['localhost', '127....
user avatar
  • 241
0 votes
0 answers
30 views

Atomic Simulation Environment - GUI appears on one laptop, but not the other

I'm a student at University using MobaXterm to access a supercomputer cluster, which runs off of a standard UNIX BASH CLI. Within this system, and within the lab I am a member of, there is a piece of ...
user avatar
3 votes
0 answers
129 views

Make `envsubst` fail if a variable is not defined

I have a file with a large number of variables in it. $ cat message.txt Hello, ${LOCATION}! You too, ${PERSON} ;) If PERSON is not defined, envsubst replaces it with nothing: $ LOCATION=World ...
user avatar
  • 323
0 votes
1 answer
20 views

pass variable from shell script to GNU parallel [duplicate]

I am using two shell scripts to set up a parallelization. The first script uses a for loop to pass an environment variable to the second script, which makes the call to parallel, which runs a julia ...
user avatar
1 vote
0 answers
18 views

sudo -E env not printing my PATH

I read the manpages but maybe I didn't understand them.. why is sudo -E env PATH="$PATH" echo "$PATH" printing out my environment variables but sudo -E env MYPATH="$PATH"...
user avatar
  • 294
0 votes
0 answers
38 views

Why is the lifespan of variables exported in .bashrc and .profile different?

If a variable is exported from .profile, it is present in all the terminals I open after log in, even though the variable was exported only once at the log in time. If a variable is exported from ....
user avatar
0 votes
2 answers
143 views

How to access env variables defined in root from another user? [duplicate]

I have a env variable test defined in the user root. This can i access inside user root using command: echo $test Now i switch to another user myuser using su - myuser . Now How to access the test ...
user avatar
  • 103
0 votes
0 answers
169 views

How do I edit the PATH variable in Debian 10

I am following the guidelines on Debain10 Jmeter Setup and as part of the config there is a requirement to modify environment variables, specifically the PATH variable in .profile file. I am a bit ...
user avatar
  • 111
0 votes
1 answer
119 views

Ways to launch a desktop application with environment variable

I have actually one environment variable that is needed by some GUI applications : QT_QPA_PLATFORMTHEME=qt5ct. For now I export it in ~/.bashrc. When I run qt5ct from a terminal, the app sees the ...
user avatar
-2 votes
1 answer
81 views

How safe is an environment variable [duplicate]

Let's say I export FOO=var in a shell. What would it take for someone else, root or other, to detect that the key of this variable has been set, and maybe even learn the value of it?
user avatar
  • 669
3 votes
1 answer
385 views

Wildcard in PATH (environment variable)

I have a bunch of apps installed locally in my home directory. In order for them to be globally available I add them to PATH in .bashrc: PATH="$PATH:/home/user/apps/app1/bin" PATH="$...
user avatar
0 votes
2 answers
143 views

How to change /proc/*/environ of a bash shell

This is the shell's PID: nathan@guixlaptop ~ $ $$ bash: 10984: command not found I export an environment variable: nathan@guixlaptop ~ $ export TESTVAR=test The variable is not found in the shell's ...
user avatar
0 votes
1 answer
92 views

Why does $HOME not expand the HOME variable here?

I wrote a simple script. read -p "Enter the path: " path echo "$path" I give the input as $HOME And the output is: $HOME And if I write echo "$HOME" outputs /home/sam ...
user avatar
1 vote
0 answers
159 views

Fedora 35 gnome-x11 incomplete environment variables

For unrelated reasons (XWayland crashing the Bash too often with applications like gnuplot, firefox...) I'm trying to start the "Gnome on X11" when login into my Fedora 35 laptop. This is ...
user avatar
3 votes
1 answer
116 views

Automatically set an environment variable to be equal to another variable

I would like to create an environment variable which is an "alias" of another environment variable. i.e. whenever the original variable changes, this alias variable changes with it. How do I ...
user avatar
  • 31
5 votes
1 answer
473 views

Tilde expansion vs. variables in Bash

Please, consider the following snippet: $ export xx=foo $ sudo bash -c 'echo $xx ~' /root Which is ok. We can't see xx. However, if I expose it: $ sudo -E bash -c 'echo $xx ~' foo /home/xropi Though ...
user avatar
  • 63

1
2 3 4 5
29