Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [environment-variables]

Environment variables are system-wide variables which share the same value. These variables are often parsed by the shell when executing commands, and are expanded into their appropriate variable. For example, this allows users to move file locations without needing to update hard-coded paths in ...

0
votes
1answer
32 views

Search and replace environment variable's value via batch file?

I want to create a batch file to quickly switch a PATH variable in order to be able to work in a different environment, and then another to restore it. I assume that it would be done via setx and some ...
0
votes
1answer
25 views

if -else in shell script, matching argument with string

For the following shell script - #!/bin/sh main_version=0 feature_version=0 patch_version=0 if [[ $1 -eq "m" ]]; then main_version=$((main_version+1)) fi if [[ $1 -eq "f" ]]; then ...
0
votes
1answer
11 views

How to use variable in variable in bash?

I have two variables - regex="<version>[0-9]*\.[0-9]*\.[0-9]*[^<]*<\/version>" updated_regex="<version>${main_version}\.${feature_version}\.${patch_version}${tag}<\/version&...
0
votes
1answer
26 views

Want to set an environment variable with TIME /t

I want to set a Windows environment variable from the results of TIME /t. In Windows, the %time% variable yields one format (13:17:52.79), whereas TIME /t has another (01:17 PM). I've tried ...
0
votes
1answer
22 views

Create Percentage Sign Variable to use in Environment Variables

In Windows 10, some environment variables actually use percentage signs to refer to paths. For example, the PSModulePath environment variable looks like this (ignore the additional one I marked out): ...
2
votes
2answers
128 views

Set PSModulePath Environment Variable with PowerShell in Windows 10

I don't understand this. So currently my system environment variable named "PSModulePath" looks like this: %ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\...
-1
votes
0answers
20 views

What is the easiest and shortest way to know java installation folder in bash? [duplicate]

The only way i know right now is- echo $(/usr/libexec/java_home) I tried editing .bash_profile to add export JAVA_HOME=/usr/libexec/java_home but still it didnt do the trick, so any other ...
1
vote
1answer
31 views

Unix/Linux - service unit file cannot recognize env variable set in /etc/environment

I have an environment variable setup correctly in /etc/environment I have ensured that it loads correctly via /etc/profile modification. and I can echo it to confirm. but when I created the unit ...
0
votes
0answers
208 views

Windows 10 environment variable PATH not getting updated

Inspired by the following video link : https://www.youtube.com/watch?v=JQ58d3BEV_8 I tried to change the PATH variable of my system and add the path that has been mentioned there . Ii have a ...
0
votes
1answer
50 views

pip command error during installation of requirements.txt

When I run the command py -2.7 -m pip install requirements.txt, I'm getting the error but I have already upgraded it but I'm still getting error in installing requirements.txt. When I use the ...
1
vote
1answer
214 views

Setting an environment variable in Windows 10: gPodder

I have just installed the podcast client gPodder (https://gpodder.github.io/). I am trying to change the default download directory, and the manual indicates that you set the environment variable ...
0
votes
0answers
40 views

Registering an Application to Custom URI Scheme with environment variable

I'm following the guide here on Microsoft's site to register an application to a custom URI scheme. This works if I can provide a static path to the executable to run shell open command ...
0
votes
0answers
20 views

Where does $HOME variable comes from and why I can't change it? [duplicate]

I know this is stupid, but last 30 minutes I am trying to change $HOME variable to other value, doing $Env:HOME = "desired value" did nothing for me, I tried couple other suggestions from the first 10 ...
1
vote
1answer
27 views

Add ~/projects/*/bin directory in environment PATH (Ubuntu 16.04)

Everything is in the title. I know how to add new path in the environment PATH variable but I would like to make it recursive by automatically adding /bin folders of all my future projects. Something ...
1
vote
1answer
90 views

Batch file not returning correct value after using bat to exe

I'm having lots of issues with this script. It's supposed to read the a file (that the user specifies) then save it to the storeresult environment variable. I'm using a BAT To EXE converter that ...
2
votes
0answers
74 views

Globally set environment variables for gpg-agent in MacOS High Sierra

I want to use gpg-agent instead of ssh-agent in MacOS High Sierra. To achieve this I need to set globally two environment variables: GPG_TTY=$(tty) SSH_AUTH_SOCK=${HOME}/.gnupg/S.gpg-agent.ssh This ...
0
votes
0answers
30 views

How to get values, log into server and run commands using PuTTY with the values

I am trying to create an automated (batch) script (i.e., for Windows) to collect hostname and instance name (SID), open PuTTY using my username/password & host to login into the server and issue ...
0
votes
1answer
51 views

How to override environment path variable to call curl from custom path instead of system32 path?

I have a path for folder containing curl.exe file (C:\My\Custom\Directory\) added to Path Environment Variable. The problem is that when I call curl from command line, it runs another curl executable ...
0
votes
2answers
53 views

automatically setting an environmental variable before invoking GUI app

I have a windows GUI app, say prog.exe, which is located in a folder in the system path. The app is not mine, and all I have is binary, so I can't change the program. I have a file type, say *.typ, ...
0
votes
0answers
102 views

What/Where/How is the proper place to configure the PATH environment variable in zsh?

The official zsh manual seems to recommend that you configure the PATH environment variable in zshenv: http://zsh.sourceforge.net/Intro/intro_3.html `.zshenv' is sourced on all invocations of the ...
0
votes
1answer
77 views

How to set/Change default $PATH value for all users?

How to set/change the default $PATH environment variable to be $PATH/root for all users at the same time ?
0
votes
2answers
44 views

How to pass the variable of the result of find command to dd

I'm trying to transfer CentOS.iso file to a USB flash drive using dd command by passing a variable which is a result of find command. I want to pass variable like this dd if=$isofile of=/dev/sdb ...
0
votes
2answers
96 views

how to use output as VARIABLE and put trimmed value into CLIP?

can anyone teach me the right way? here is my attempt code: @echo off SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION "%~dp0..\x64\mediainfo.exe" --Inform=General;%%UniqueID/String%% "%~dp0..\files\...
0
votes
0answers
45 views

Does squid support variables (or similar) to indicate external acl path?

Does squid.conf support variables to indicate external acl path? Problem: I need to replace the path to my lists (which are many) by a variable or something similar, for when I want to change the ...
0
votes
0answers
36 views

AWS ElasticBeanstalk (Python) Environment Variables disappear after being set

So I am experiencing a funny problem. I am using ElasticBeanstalk on AWS, and I have several Applications initialized along with their corresponding Environments. In the past I have been able to ...
0
votes
2answers
39 views

Trying to use an environment variable in a .cmd script, getting the message “\Windows was unexpected at this time”

I need to access a windows environment variable in a .cmd script, it looks something like this, following the documentation on microsoft's support: if "%MY_ENV_VAR%" == "" ( echo You must set your ...
0
votes
1answer
259 views

how to set $HOME variable so that cmd find the path

Regardless of what directory I am at, for instance, when type in cd ~/Documents/project in git bash, it works. Whereas, it will not work doing the same in the cmd. It says: the system cannot find the ...
0
votes
1answer
120 views

How to copy environment variables from local shell to a remote ssh connection inside a shellscript?

I am currently working on a shell script that is used to build docker images and restart containers running on the remote host. below is the stripped down version of the code. #!/bin/bash -xe # ...
1
vote
0answers
43 views

Finding where an env variable is set

I have the problem that my http_proxy is wrongly set, whenever I start a new terminal: » echo $http_proxy http://http://127.0.0.1:1234/ Which is ... bad. I have a bug somewhere in my environment ...
1
vote
1answer
72 views

How to allow users to execute a script without revealing protected information

Given that the root user has some credentials (say, an API key) set in an environment variable, and given an unprivileged user John, how can I let John execute a script that uses said API key without ...
0
votes
1answer
202 views

User32.Lib inclusion

I'm trying to compile a Windows version of Chromium. I followed the guidelines mentioned here and I'm getting an error at the last part, when running the following command: gn gen out/Default After ...
1
vote
1answer
410 views

Setting variable in /etc/environment has no effect

I have the following in my /etc/environment: http_proxy=http://myproxy.net:12345 After rebooting the machine, I login and check the variable: root@d6c44fa03243:/# echo $http_proxy (empty) Why is ...
1
vote
3answers
148 views

Split variable in 2 after the last dot

I need to cut variables in two smaller variables after the last dot. For example the variable "european.union" will be vara=european and varb=union I use the following code to accomplish this purpose:...
0
votes
0answers
54 views

Using %userprofile% vs \\server\profile\user

I am currently in the process of deploying DWG TrueView on Windows Server 2012 R2 which is used as a terminal server. Since the users don't have any admin rights I need to set some registry keys to ...
0
votes
1answer
186 views

Best way to specify domain and all sub-domains in NO_PROXY?

Interpretation of the NO_PROXY environment variable doesn't appear to be officially standardised. And most documentation for specific programs is fairly fuzzy about its exact interpretation (e.g. ...
1
vote
1answer
32 views

$PATH of directory shows in bash but not in editor

I am trying to set a path in my $PATH: /home/ryan/.nvm/versions/node/v9.6.1/bin When I echo $PATH it is there, but when I open vscode, and check the process.env.PATH it isn't there. I am not sure ...
1
vote
0answers
60 views

environment variable expansion in bash

Bash used to expand environment variables when you hit tab: cd $PWD would result in $PWD being expanded. When you hit return, the expanded path would go into your history, which was really useful. ...
0
votes
0answers
18 views

Intercept environment variables read by a process

I have a process that’s reading some environment variables to set itself up, but I’m not sure which one. The programming language is foreign to me, so let’s supposed I don’t have the source. Is there ...
2
votes
1answer
71 views

Environment variable set in the dhcpcd.conf profile is not passed to dhcpcd run hooks

When I set variable in the profile in the /etc/dhcpcd.conf it is not passed to the hook script: interface eth0 arping 192.168.0.1 profile A1:B2:C3:D4:E5:F6 env enable_proxy=1 However, when I put ...
3
votes
0answers
54 views

AWKPATH in windows is not loading resources (gawk 4.2)

I am running gawk 4.2 on a Windows 7 machine. I've tried setting up the AWKPATHenvironmental variable to @include some reusable pieces of scripts in my running gawk programs. This is what is happening ...
0
votes
0answers
438 views

Vagrant ruby path issues with cmder

I recently installed cmder, a terminal that is more customizable / visually easier than windows command prompt. When I run a command like vagrant ssh in cmder, I get this error: Exec error: exec: "...
0
votes
0answers
290 views

how to set temporary environment variable windows command prompt like bash?

In Bash I can create TEMPORARY environment variables on a command line. For eample DEBUG=foo somecommand This sets the environmnet variable DEBUG but only for somecommand. When the line is finished ...
0
votes
0answers
38 views

PATH variable is empty

I tried to run ipconfig at work after being away for a while and it suddenly didn't work. It does work if I run c:\Windows\System32\ipconfig.exe I then tried echoing the PATH variable and it looks ...
-1
votes
2answers
57 views

bash + how to capture the requated field from variable

we set the variable with the follwing values MY_VAR=" one two three four" how to capture the first value from variable with bash? ( without using echo command ) expected output one
0
votes
1answer
26 views

Interpolated Environment Variable unset in cronjob using /bin/ip command

I have the following script in myuser's home directory #!/bin/bash # startup.sh export HOST_IP=$(/bin/ip -4 addr show enp2s0 | /bin/grep -Po 'inet \K[\d.]+') echo "Using HOST_IP=$HOST_IP" and the ...
3
votes
1answer
426 views

SSH not passing LANG environment variable

I'm running a Debian server (uname -v output #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23)). When I log in from any of several clients (macOS 10.13 laptop with default ssh, the "Prompt" app on iOS, among ...
0
votes
1answer
59 views

Can Windows 7 double nest environment variables?

In the GUI: WORK_HOME=D:\work LOG_HOME=%WORK_HOME%\logs FOO_LOG_HOME=%LOG_HOME%\foo On command line: echo %LOG_HOME% D:\work\logs but echo %FOO_LOG_HOME% %LOG_HOME%\foo The only difference is ...
0
votes
1answer
293 views

HomeDrive vs. SystemDrive

On my computer, these two variables gives the same result: echo %HomeDrive% -> C: echo %SystemDrive% -> C: Is there any difference between them? Reference links are welcome, because it's ...
1
vote
1answer
1k views

How can I set environment variables in a GitLab CI docker runner?

We need to set a company proxy to reach the internet from within our network. This is needed for the build-process (to fetch dependencies). I have added the appropriate lines into /etc/bash.bashrc in ...
0
votes
1answer
62 views

SED : How to use variables

I'm making script for Post OS install which will be consisting of setting env for Apps and DB and also will include hardening. Doing this manually is not practical which takes hours when a Bash script ...