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
0answers
20 views

How to set environnement variables for all users and all processes and make them accessible before login

I would like to add a directory to my PATH that will be accessible by all users and all processes and accessible before login. I've tried adding it in /etc/profile, but that only works for bash. I've ...
0
votes
1answer
41 views

Where do I place environment variables so that they can be picked up by Apache?

I'm using Ubuntu 18.04. I have defined a series of environment variables in my /etc/profile file. When I login as my user, I can see them using $ echo $DB_NAME directory_data I have Apache 2.4 also ...
1
vote
1answer
124 views

debian interactive shell does not call .profile [duplicate]

I have just installed a brand new debian buster: $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster $ ...
0
votes
1answer
33 views

How to start Jetty using start.jar from the console?

Having installed Jetty through apt how do I start the web server to get to a welcome page? Trying: java -jar /usr/share/jetty9/start.jar results in: ERROR : Nothing to start, exiting ... Usage: java ...
2
votes
1answer
47 views

Rename and add to $PATH

I know that I can add a path to the $PATH on the bash terminal with the command PATH=$PATH:foo . I also know I can create an alias for the bash with the command alias a=b But only know I noticed that ...
0
votes
2answers
53 views

How to store and print variables with special characters in shell/bash/sh/

I basically need to load, save and reload multiple times and in different forms a variable that contains arguments for a program. The problem is that this variable can't be treated as a usual variable ...
0
votes
0answers
13 views

svn authentication on unsafe machine

i need to access some repository on an unsafe server. I dont want to store my password anywhere else than current session. What I came up with so far is combination of histcontrol ignorespace then ...
0
votes
1answer
78 views

In a bash script, how do I write a command for a remote machine using the remote machine's environment vars?

I'm trying to write a bash script on Ubuntu 18. I have the below script ... #!/bin/bash -l ssh myuser@remote-machine 'mysql -u $DB_USER --password=$DB_PASS $DB_NAME < /tmp/dump.sql' My primary ...
1
vote
1answer
25 views

set environment variable from sh script in systemd service file

I am trying to use a ready-made bash script that sets env. This is the service that I'm trying to use: [Unit] Description=myserver service After=multi-user.target [Service] Type=simple User=ec2-user ...
1
vote
1answer
26 views

why are environnement variable not resolved when doubl-clicking .desktop file?

I have a java app which is launched by a shell script. The first part of the shell script is to resolve the java location by looking at $JAVA_HOME. The shell script is working well if launched from ...
0
votes
1answer
24 views

How to make path to current directory visible in bash, in order to be seen by linker?

I am trying to load shared library, but I dont have its .so file in directory loader look for, So I want to set a environment dir. $ ls # (current dir is bindir) foo.c foo.h libfoo.so exe $ ...
1
vote
2answers
61 views

'export'ing a variable in shell script [duplicate]

We have two scripts, first.sh and second.sh. We run first.sh from second.sh using the . (source) command. I am stuck at this script, first.sh value="myvalue" export value oldvalue="othervalue" ...
0
votes
0answers
23 views

enforcing an envirnomental variable to a terminal/tty [duplicate]

I am running few remote ssh sessions # ls /dev/pts/ 0 1 2 ptmx One of the sessions running a live program, which depends on some environment variable(e.g. $CATALINA_OPTS). I want to change the ...
2
votes
1answer
45 views

With systemd, should environmental variables ever be declared in ~/.profile or ~/.bashrc?

It seems to me like with environment.d now sourcing environmental variables in ~/.config/environment.d/*.conf that we should no longer have environmental variables declared in ~/.bashrc or ~/.profile ...
1
vote
1answer
42 views

linux capabilities to read environment variables?

I'd like to run a service as a non-privileged user, but it needs to bind to a system port number (i.e. less than 1024), so I give it setcap 'cap_net_bind_service=+ep' <path for service>, all ...
1
vote
0answers
18 views

tmux/bash start tmux only if normal shell (intellij)

I have a little problem, I let tmux start in the .bashrc but I only want it to start, if the shell is a normal shell inside my terminal emulator. Now most IDEs have a terminal tab where they launch a ...
0
votes
0answers
24 views

How to change directory from environment variable in tcsh?

I have captured a linux path into an environment variable. Now I want to change the directory to the path in that environment variable. Lets say the environment variable is named: gr I can see the ...
0
votes
1answer
72 views

How to start a systemd user unit over ssh connection with correct environment variables?

I have a systemd --user unit that runs correctly when run from the machine's console (Arch Linux). However, when I ssh into the machine and run the same command to start the user unit, it fails. The ...
0
votes
1answer
21 views

How to export lines from other file into current shell

I have this content in a file called foo.env: foo=bar and then I want to read that file and export the lines to the shell: for line in $(cat ./foo.env); do eval export $line done but when I run ...
0
votes
0answers
11 views

refresh readonly environment variable in Linux

I have below scenario - set environment variable for all users who log in to the server through profile.d make this environment variable read-only so that user doesn't get to change it now comes ...
0
votes
0answers
17 views

Force application to use specific icon theme

I'm wondering if there is any way (for example via environmental variables), how to force selected application to use a specific icon theme without changing the currently set one? Let's say Telegram ...
0
votes
0answers
34 views

Issue starting applications with environmental variable

I want to be able to start application, any application, with this command HOME=/home/user/data appname, and application to save its data in data folder, basically changing the home location of the ...
0
votes
2answers
44 views

How come I can change my PATH to gibberish and still use commands?

The environment variable PATH is the search path for executable commands, so I thought changing the PATH to something that doesn't exist (for instance, export PATH=blah) would make me unable to use ...
1
vote
1answer
26 views

Prompt for value to store in env variable

I'd like to store a value in an environment variable, but I don't want to do it like this VAR_NAME=secretvalue, because then it will be stored in the shell's history file. Is there a way to prompt me ...
0
votes
1answer
26 views

Why doesn't /etc/environment work for systemd services

I've set my PATH in /etc/environment, and it works when I log in as any user, but when I run my services as any user, it doesn't respect my /etc/environment. What gives?
0
votes
0answers
14 views

How do I get my bash script to see the environment variables of the calling shell? [duplicate]

I'm using bash shell. I have a simple script ... localhost:web davea$ cat test.sh #!/bin/bash echo $DYLD_LIBRARY_PATH echo $DYLD_LIBRARY_PATH source ./venv/bin/activate python manage.py migrate ...
0
votes
1answer
56 views

What does the “export” command do to a variable?

When we set a environment variable in bash we have to export it. so in future we can use it.(atleast in a continuous session). I understand this. My question is what exactly doe the export command ...
3
votes
1answer
36 views

Security: shell scripts to reset the IFS variable against misuse?

From my reading of O'Reilly's "Classic Shell Scripting," it looks like you want to reset the input field separator IFS to newline, space and tab at the start of every shell script to guard against ...
1
vote
0answers
25 views

Pass env value to docker-compose command through bash script

I am using the following docker-compose.yml file (excerpts) version: '3' services: app: build: . volumes: - .:/usr/src/app ports: - "36081:36081" restart: always ...
0
votes
1answer
336 views

Can't set up environment path variables in Kali Linux installation

I downloaded flutter and Android studio on my linux machine. It is a kali linux installation. I want to add environment path variable for both android studio and flutter permanently so, who when I ...
0
votes
0answers
21 views

Apache environment variable

Im trying to add some environment variables to apache centos 8. Usually those are simply added to /etc/sysconfig/httpd on previous centos versions (mainly centos 7); but this directory is not present ...
0
votes
0answers
39 views

Environment variables not passed to program

The setup I have is a bit convoluted but I'll try to be as clear as possible. I'm on macOS, and I use skhd as my hotkey daemon. It's basically a program that lets me assign keyboard shortcuts to ...
0
votes
1answer
45 views

VISUAL and EDITOR variables aren't defined

I'm using CentOs 6 and learning about command line editing modes. The VISUAL and EDITOR variables aren't defined in my system and printenv or env commands don't show them. My X terminal starts in ...
0
votes
2answers
34 views

Launch new terminal instance with zsh using custom prompt string

I want to be able to launch a terminal emulator (preferably gnome-terminal) with interactive zsh running inside using a custom prompt string. I don't want to modify my default prompt string in .zshrc ...
1
vote
0answers
46 views

Environment variables in project are all wrong/different

I'm not an expert nor very proficient in OS and shell commands, and that's why I've come for help. I was successfully storing my API Keys for my Flutter project as Environment Variables, until I had ...
0
votes
1answer
39 views

What is the correct approach to refresh a running production environment

I am not showing much code here , but I have a requirement to fix. We have file with over 100 function that are being used in various shell scripts in production. We have named it as. functions.sh ...
0
votes
1answer
14 views

Update Xterm Title Bar with Conda environment prefix

I wanted to update my gnome terminal tabs to indicate the conda environment that was active in that terminal. I typically have many tabs and a few environments activate at once, so finding the right ...
2
votes
2answers
65 views

Is it safe to copy user's .bashrc to /root/.bashrc?

I am running Debian. The default /root/.bashrc is kinda empty. So if I do sudo -i to login as root, there are many things are not setup properly. Normally, I just do the following: $ sudo -i # mv ....
0
votes
1answer
38 views

Can I put $SECONDS into an environment variable in a bash script?

I'd like to be able to have $SECONDS shown with hours, minutes, seconds in an environment variable, so I only need to use, e.g. $RUNTIME in various places in the script rather than have the whole ...
2
votes
3answers
600 views

How to modify the PATH environment variables in Catalina?

Some application tells me to add something to the PATH environment variables, I know one way to do this is by creating a file at ~/.zshrc, but I would like to know where is the file the variable PATH=....
3
votes
1answer
106 views

Aspell: how to change home dir globally?

aspell creates following files in my home: .aspell.en.prepl .aspell.en.pws How can I change the location globally, i.e. to $HOME/.cache/aspell ? I need to reference the $HOME environment variables ...
0
votes
1answer
37 views

Set environment variables in the desktop process after login

I can set environment variables to be inherited by all processes in ~/.profile. This works because the desktop environment (eg. gnome-shell) runs this file on login. gnome-shell then updates its own ...
0
votes
1answer
32 views

How to set environment variables automatically?

So I do research in machine learning and use a remote GPU server to do the stuff. What I usually do when I come to work is access the server with an SSH client and run my alias hi command which is: ...
0
votes
0answers
85 views

Get environment variable from python script

I have bash script config.sh in which several variables are exported , and I need those variable in my python script. config.sh export VAR="YES" My approach is to source the config.sh from the ...
0
votes
1answer
87 views

bash script does not work as expected through crontab

im working with sun Solaris 10 which legacy system, I have made a script that handles specific producer and it consists of bash/perl/posix/sqlplus/awk around 1k lines and it works fine in standalone ...
1
vote
0answers
45 views

Setting PATH on Wayland Gnome

I am left baffled how to correctly set PATH under Gnome Wayland (using Manjaro 19.x) I want to set PATH=${HOME}/bin:${PATH}:${GOROOT}/bin GOROOT is set in .config/environment.d/go.conf as GOROOT=$...
0
votes
2answers
29 views

Set time zone in bash file

I run a Matlab script main.m in the HPC of my university. To run the script I qsub in the terminal the following bash file #$ -S /bin/bash #$ -l h_vmem=5G #$ -l tmem=5G #$ -l h_rt=360:0:0 #$ -cwd #$ ...
0
votes
2answers
32 views

Environment variables don't expand correctly when related to a function

Here is a part of my .bashrc file: echo_pwd () { echo `pwd` } export echo_pwd="`echo_pwd`/" I created a new function echo_pwd that prints the path of the current directory and a new environment ...
2
votes
2answers
84 views

Environment variables when running unshare

Is there any namespace (process, user, etc) that isolates environment variables? In case there is, what happens when you unshare? Do they get cloned? What happens if a process changes an existing ...
0
votes
1answer
44 views

crontab cannot find environment variable even after sourcing .bashrc

crontab -e 00 00 * * * /home/username/run.sh >> /home/username/log 2>&1 Inside run.sh: source /home/username/.bashrc java When crontab job is triggered, I got this error in the log: /...

1
2 3 4 5
25