Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [environment-variables]

A set of dynamic variables that can affect the running processes behavior and access to resources.

0
votes
0answers
33 views

Knowing what directory a process started in

I'd like to be able to know mid-working what directory a child process started in. Here I'm in a Bash session, I start a dash session and I'd like to know where did dash start (in the example it ...
1
vote
0answers
30 views

Ruby script is not picking up sourced env vars

I am using environment variables in a Ruby script. When I export the variables and run the script as follows, it works fine. export ELK_URL="https://localhost:3241" ruby ./my_script.rb The contents ...
0
votes
0answers
11 views

Gnome3 Session Startup File

What is the location of the "Gnome3 Session Startup File". I use Ubuntu 18.04 with gdm3 as display manager. I want to export an environment variable (persistent) for GUI (desktop) application. Also,...
0
votes
1answer
83 views

$EDITOR environment variable won't set

Whenever I attempt to set the EDITOR environment variable, a subsequent check reveals no value has been set. I was attempting to edit the crontab: sudo crontab -e -u mycooluser which returns: no ...
0
votes
2answers
23 views

creating OS environment variables using ExecStartPre on Systemd

I have the following unit file: [Unit] Description=Panel for Systemd Services After=network.target [Service] User=pysd Group=pysd PermissionsStartOnly=true WorkingDirectory=/opt/pysd ExecStartPre=/...
0
votes
1answer
28 views

How to view the binary contents of environment variables?

I'm practicing CTFs (capture-the-flag) and want to view the contents of an environment variable: MyEnv=`python3 -c 'print(64*"A"+"\x0a\x09\x0a\x0d",end="")'` Now, hexdump displays the following, ...
0
votes
1answer
13 views

how does the expression b=${b:-“/data”} work [duplicate]

I've run a cross a shell script with BUILDDIR=${BUILDDIR:-"/data"} which , upon experimentation, takes the original BUILDDIR if it exists and isnt an empty string, and otherwise sets it to /data. What ...
0
votes
1answer
40 views

Debian Linux - Setting an environment variable for all users

I added the following in /etc/profile so that all my users can see the path export JAVA_HOME=/opt/jdk11 export PATH=$PATH:$JAVA_HOME/bin But after restarting my laptop, I cannot see the changes ...
1
vote
2answers
69 views

Bash environment variables in non interactive mode

I'm trying to define environment variable for non-interactive console in Raspbian. In theory I need to add the varaibles to ~/.bashrc or ~/.profile or /etc/bash.bashrc or /etc/profile. For example I ...
5
votes
3answers
945 views

Equivalent to “source” in OpenBSD?

Trying to open a python3 virtual environment I have created with python3 -m venv myVenv by doing source myVenv/bin/activate as I do in Linux, but I get ksh: source: not found which mean it is ...
0
votes
0answers
33 views

How do I get CRON to run a script that works in my regular shell, but not in CRON? [duplicate]

I am running Ubuntu 18.04 LTS on an Amazon LightSail instance. When I try to run a Python script as soon as I log, it runs perfectly. I run my script with the full path in with the command: /usr/bin/...
1
vote
1answer
98 views

How to persist environment variables in ash, the Almquist shell?

How can I get ash to load some environment variables on startup? Just put them in /etc/profile /etc/profile is only read for login shells; what about non-login shells, as frequently pop up when ...
0
votes
1answer
192 views

How to change default text edior for virsh edit? (setting EDITOR env variable didn't work)

I recently installed virt-manager on an Arch Linux install, and unlike under Ubuntu, I was not prompted to choose a text editor on the first launch of virsh-edit. Instead, the XML file was opened in ...
0
votes
0answers
32 views

HTTPS=true is not working [duplicate]

I'm trying to set the environment variable HTTPS=true in macOS bash shell but it doesn't work when I printenv the variable HTTPS=true doesn't appear: TERM_PROGRAM=Apple_Terminal SHELL=/bin/bash TERM=...
0
votes
1answer
25 views

Comparing working directory with “string” [duplicate]

I'm trying to compare the current working directory's path with my home directory's path. user@machine:~$ echo $PWD /home/user user@machine:~$ if ["$PWD" = "/home/user"]; then echo True; else echo ...
0
votes
0answers
40 views

Init script not picking up environment variable set in /etc/environment?

What is the right way to set a global environment variable, such that it is picked up all processes, including those started via init.d (service <service> start), on Ubuntu? Details: I first ...
0
votes
3answers
53 views

Which quoting style GNU Bash variable definitions (mostly for paths)? [closed]

Which of the following quoting styles, for GNU Bash variables, is preferred and why? Two double quotes: VAR="/path/$V1/path with space/$V2". Multiple double quotes: VAR=/path/"$V1"/"path with space"/"...
0
votes
0answers
27 views

How do I prevent module load conflicts (environment modules)?

I am setting up Environment Modules for a server and have two modules: test1 and test2. Test1 needs java 1.7.0 and test2 needs java 1.8.0. If I use prereqs/conflicts, as seems to be standard ...
1
vote
1answer
63 views

How do I properly change the debian default python 2.7.9 to python3 or another version? [duplicate]

what is best-practice for changing the default global python interpreter on my fresh debian-based linux node to python3.x? When I create a fresh Debian or Ubuntu VM, one of the first things I do is ...
1
vote
1answer
39 views

My Java environment variables seem to be a complete mess how do I make a clean start without reinstalling?

I am trying to get Janusgraph working on OpenSuse Leap 42.3 but I'm running into a multitude of problems. My understanding is that JanusGraph invokes other Java dependencies, including gremlin & ...
1
vote
0answers
64 views

How can I set and export an environment variable in a systemd service?

after starting agetty on my Raspberry Pi in order to attach a VT420 terminal to it, I still have an issue: The shell language must be set to en_US and exported by hand right after logging in on the ...
4
votes
1answer
155 views

Bash can't find scripts in $PATH [closed]

I'm setting up a completely new, fresh Ubuntu 16.04 Minimal system, and have run into a weird problem. Even after adding $HOME/bin to the $PATH, bash can't seem to find any of the scripts in it, at ...
2
votes
1answer
86 views

Why is my BASH_FUNC_foobar%% environment variable unset in shell subprocesses?

I'm messing around with the security of a setuid binary (with the intention of disclosing anything I find to the author, obviously). I'm pretty sure it has an arbitrary code execution vulnerability ...
0
votes
2answers
141 views

Eval and exec with variable substitution

I'd like to execute a statement to start a server. For that I have an environment variable to determine which server is to be started. I was given this command as a starting point: eval "exec ...
0
votes
0answers
12 views

set env variable apache when accessing a specific url

is there a way to take a user id sent in the http header and to rewrite it to a variable "remote_user" but only when accessing a particular URL? I'm aware of SetEnv but that doesn't do the trick I ...
0
votes
1answer
63 views

How do I use ssh-agent as a wrapper program?

I'm trying to start awesome windows manager as a subprocess of ssh-agent. It worked when I used startx (ssh-agent startx). But now I'm trying to make it work under lightdm. lightdm starts /usr/bin/...
0
votes
1answer
59 views

Java-like properties file to environment variables

I need to convert each property of a properties file to a environment variable: I mean, guess this property file: mongo.port=27017 mongo.host=127.0.0.1 mongo.databaseName = test bo.url-jwt=https://...
3
votes
1answer
128 views

How is the C library able to access environment variables?

This may be a dumb question, as I feel like I must be overlooking something fairly obvious, but how do functions like getenv(3) access the environment when my program doesn't have any references to ...
1
vote
2answers
70 views

How can I “source” expect script

I'm forced to use a script like below: # test.sh function my_fun { echo "Give value for FOO" local my_var read my_var export FOO=$my_var } # Call my_fun function my_fun by sourcing ...
0
votes
1answer
50 views

Where to define proxy environment variables for firefox started via desktop links in lxde/debian9?

I'm trying to set the system-wide http_proxy environment variables (automated by a shell script) in such a way, that firefox uses them when executed from the LXDE start menu for all users. So far I ...
0
votes
1answer
156 views

Expand variables in local bash script before passing it to SSH

I am trying to execute a script on a remote host through SSH. The script uses environment variables that are set on the local shell. The variables in the script are not expanded. ssh user@host 'bash -...
0
votes
2answers
109 views

Apache/Nginx document root environment-variable

Apache/Nginx "default" document root path is usally /var/www/html but theoretically this could change tomorrow. Having a distro-default and communally-maintained environment variable for it (instead ...
2
votes
2answers
778 views

import environment variables in a bash script

I set some environment variables in a terminal, and then run my script. How can I pull in the variables in the script? I need to know their values. Simply referring to them as $MY_VAR1 doesn't work; ...
2
votes
1answer
64 views

cannot find package with running go build

root@kali:~/subfinder# go build main.go:15:2: cannot find package "github.com/subfinder/subfinder/libsubfinder/helper" in any of: /usr/lib/go-1.11/src/github.com/subfinder/subfinder/libsubfinder/...
1
vote
1answer
43 views

Messed up environment variables in Centos 7

When I am running my maven build I am getting this error: Error: JAVA_HOME is not defined correctly. We cannot execute /usr/bin/bin/java I have edited .bashrc, .profile, /root/.profile and /root/....
3
votes
2answers
117 views

How do I specify a path to an executable for a systemd unit file on nix?

I'm trying to write a systemd unit file. How do I specify the path to an executable? How can I determine what to use? In this specific case I'm trying to use mkdir. ExecStartPre = "/bin/mkdir -p %h/...
1
vote
1answer
36 views

RedHat/Centos6.5 Environmental Variables Set on Startup - but from where? [duplicate]

I using Redhat/Centos 6.5. I am starting up the system and it already has environment variables set and is already running processes when it starts up. My questions: Where do these environment ...
3
votes
0answers
131 views

How to protect an EnvironmentFile used by a systemd service?

Background I have multiple RESTful web services being deployed through Azure DevOps Release Pipelines to a CentOS VM. Each of these services is managed by systemd and uses environment variables to ...
1
vote
0answers
47 views

Linking issues with leptonica and libpng

Working through an install of tesseract without sudo permissions and without a standard bevy of prebuilt libraries. The installation I've got to go through as far as I know follows the path of zlib -> ...
1
vote
0answers
8 views

What is the environmental variable that shows “executable folder” for Eclipse cdt?

In Eclipse cdt, I'm trying to make a project link a library from same folder of application executable (Debug at the moment). When I set "library search path" as ${PWD} it doesn't find the library ...
3
votes
3answers
877 views

How to create an environment variable that is the output of a command

How do I create an environment variable that is the result of a specific command? Specifically, I want an environment variable ($BWD) that is the basename of $PWD $ cd /home/devel/Autils/lib $ echo $...
4
votes
2answers
403 views

Cron is trying (and failing) to open env file: /etc/environment

I'm using Devuan ASCII (which is more or less Debian 9, Stretch). Now, my /var/log/auth.log has a bunch of these entries: Jan 6 09:45:01 mybox CRON[20951]: pam_env(cron:session): Unable to open env ...
1
vote
1answer
57 views

Exporting $PULSE_SERVER at start up

In order to run flatpak applications (like Discord or Spotify) I currently have to export the $PUSLE_SERVER in my ~/.zshrc or ~/.bashrc like so: export PULSE_SERVER=unix:/tmp/pulse-PKdhtXMmr18n/...
3
votes
1answer
83 views

see the LD_LIBRARY_PATH libraries

As I know we can define the search path for additional non standard libraries using export LD_LIBRAY_PATH. How can I see the list of these additional libraries after setting LD_LIBRARY_PATH?
10
votes
2answers
747 views

Why can I not use variables as prefix to a command to set environment variables?

Normally, it is possible to set an environment variable for a command by prefixing it like so: hello=hi bash -c 'echo $hello' I also know that we can use a variable to substitute any part of a ...
0
votes
2answers
92 views

Question about global environment variables and fork() & exec() [duplicate]

What I'm trying to understand is where does a child process inherit exported variables from it's parent process What I'm trying to understand is where a child process inherits exported environment ...
0
votes
2answers
135 views

How to override local variable by environment variable

I have one script running in production where one value assigns but i want to use a different value from here. My script.sh a=20181214 .... I was calling this script after export a=20181212 and ...
2
votes
1answer
30 views

Prevent print -P from substituting environment variable

I am using prompt pure as my prompt in zsh. Internally it uses print -Pn ... to print out the current directory. For some reason, if I have an environment variable set that matches the beginning of ...
1
vote
0answers
59 views

What effect does environmental variable CLUTTER_IM_MODULE have?

I knows this can be set like as CLUTTER_IM_MODULE=xim, but I don't know what effect this variable has.
0
votes
0answers
54 views

ownCloud with mariadb under docker-not avalable connection

I tried to use official documentation https://github.com/owncloud-docker/serverwith docker-compose. My .env file: OWNCLOUD_VERSION=10.0 OWNCLOUD_DOMAIN=localhost ADMIN_USERNAME=admin ADMIN_PASSWORD=...