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
30 views

zsh: How can I escape each word separately?

How can the following list of commands can be quoted separately? s="cp mkdir [[ mv rm" quoted_s= ???? This should be the output of echo $...
user avatar
  • 163
0 votes
2 answers
44 views

How to access an enviroment variable of `$SUDO_USER`'s within a shell script?

My $USER's $SHELL env variable is /bin/zsh My root's $SHELL env variable is /bin/bash I am running a Unix shell script as sudo. In this script, I need to check if $SHELL env variable of $SUDO_USER ...
user avatar
0 votes
0 answers
4 views

LXQt hotkeys use incorrect versions of commands (seem to run in different environment)

What Happened I'm using Lubuntu with LXQt version 0.17.0, Qt 5.15.3. I'm trying to run node path/to/script.js via shortcut key (defined in "Global Actions Manager"). When executed via ...
user avatar
  • 1
0 votes
1 answer
37 views

Why does the GitHub actions ssh login not set my environment variable?

When I login using ssh command to remote server Linux VM-0-16-centos 3.10.0-1160.31.1.el7.x86_64 #1 SMP Thu Jun 10 13:32:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux and execute env command, I can find ...
user avatar
  • 373
-1 votes
0 answers
29 views

Which is more reliable, $DESKTOP_SESSION or $XDG_CURRENT_DESKTOP

Which environment variable has better support. I know that desktops like GNOME or Plasma will definitely support both, but for other sessions (like i3wm, LXDE or enlightenment), which one would have ...
user avatar
5 votes
2 answers
126 views

How to set environment variables dynamically for command?

I would like to use some kind of minimalistic template engine with pure bash and envsubst: user@host:~$ env -i FOO=foo BAR="bar baz" envsubst '$FOO,$BAR' \ <<< 'Hello "$FOO&...
user avatar
0 votes
1 answer
8 views

unset proxy in a session can remove proxy from everywhere when proxy is configured in /etc/enviornment file

Suppose I have set proxy persistent way in my /etc/enviornment file and now I have run unset proxy from a session . So proxy will be there or not in this situation? What I faced that even after unset ...
user avatar
  • 1
0 votes
1 answer
32 views

"sudo bash -s --" without changing $HOME?

I'd like to run a trusted script from the internet with the sudo command like so: sudo curl https://example.org/my-trusted-example.script.sh | sudo bash -s -- The script is using the $HOME variable. ...
user avatar
1 vote
0 answers
19 views

Insert environment variable in system files - Lubuntu 22

Is it possible to insert environment variables in a YAML file in /etc/netplan/ to change IP, gateway or DNS dynamically? Can I do the same for HOSTNAME in /etc/host and the various .sh scripts in /etc/...
user avatar
1 vote
1 answer
28 views

fish shell: universal variables and alias not shared between "contexts"

I use fish shell mainly from Rider IDE and iTerm2. I've noticed that every task that implies saving something for future sessions will not operate transparently between the two aforementioned contexts....
user avatar
1 vote
2 answers
27 views

like history and fc but for a personalized list of useful commands

I have spent a few hours trying to get an easy access to my most useful commands I have to use in a certain environment, I have the "incredible" idea of using history for that purpose, to ...
user avatar
2 votes
2 answers
53 views

How do I add to PATH a directory with colon (":") in it?

Here I found the file with ..:; name. mkdir '..:;' worked fine. But in PATH directory names are split by :. How to add this directory to PATH?
user avatar
  • 203
-1 votes
1 answer
50 views

Why is “echo $SHELL” not captured by remote SSH output?

When I capture the output of a remote SSH call using cat, whether in bash or in Python, things work as expected. E.g, this works just fine: import subprocess rc = subprocess.getoutput(“ssh user@host; ...
user avatar
1 vote
1 answer
43 views

Fish EDITOR environment variable does not seem to work

I recently started using the Fish shell. echo $EDITOR returns vim But yet, when using programs that need to launch an editor and look for it in the EDITOR environment variable they don't seem to find ...
user avatar
  • 133
3 votes
1 answer
80 views

Why is executable found without a full path despite its location not in search path?

This question is about understanding the reason(s) behind a perceived inconsistency between documented and actual behavior when calling an executable through sudo. When the secure_path option is ...
user avatar
  • 135
0 votes
1 answer
49 views

Refer another Java version in a systemd service file

I have an application which requires JAVA_HOME environment to be set for a successfull running. On the RHEL server, however the current version of java points to "openjdk version "1.8.0_302&...
user avatar
0 votes
2 answers
49 views

Where is the EDITOR env variable originally set?

Where is the EDITOR environment variable initialized? so far I have checked the following files and could not find where it is: ~/.bashrc ~/.bash_profile ~/.profile /etc/profile /etc/bashrc /etc/...
user avatar
0 votes
1 answer
32 views

Exporting environment variable to user after login via su

I am struggling to work out what exactly the following alias does. I guess it is making the environment variable COUNTER available to the user nobody but the COUNTER=${COUNTER} preceding the ssh and ...
user avatar
  • 157
0 votes
1 answer
173 views

environment variable isn't read in bash script

I'm deploying a nodejs app to a EC2 instance on AWS through codecommit/codebuild/codedeploy. In my appspec.yml file for codedeploy, I have a script called application_start.sh, which is called when ...
user avatar
  • 121
0 votes
1 answer
63 views

Default Value for the GREP_COLORS Environment Variable

On my Ubuntu 20 system, the default coloring when the grep --colors=auto option is used is red text on the normal background. This behavior can be overridden by providing a value to the GREP_COLORS ...
user avatar
0 votes
1 answer
228 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
128 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
1 vote
1 answer
42 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
  • 467
0 votes
2 answers
57 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
  • 301
3 votes
0 answers
29 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
145 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
1 vote
1 answer
178 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
  • 123
4 votes
1 answer
410 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
139 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,153
0 votes
1 answer
135 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
169 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
55 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
135 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
38 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
292 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
245 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
107 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
52 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
28 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
284 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,515
0 votes
0 answers
169 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
  • 147
1 vote
1 answer
52 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
199 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
45 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
128 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,069
0 votes
3 answers
225 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
41 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
359 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
  • 960
0 votes
1 answer
51 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
  • 401
1 vote
1 answer
106 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

1
2 3 4 5
29