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 scripts (they just have to update the environment variable).
1,299
questions
0
votes
1
answer
9k
views
Powershell: dynamic variables within foreach
I am trying to do some math for a dynamic list of users that I will use to run a search and count some results anonymously, then add to a running total per user. So, for instance:
$users = Get-...
1
vote
1
answer
199
views
What is the recommended way of managing environment variables in Unix systems? [closed]
I have always been thinking about the effective way of managing environment variables in operating systems like Ubuntu, macOS, etc.. I have a couple of questions related to it.
Is there a common ...
1
vote
1
answer
401
views
ifs environment variable is not inherited
In Unix the IFS variable was often used to subvert system integrity.
How it was fixed?
The only answer I found is in wikipedia page
http://en.wikipedia.org/wiki/Internal_field_separator which says:
"...
4
votes
2
answers
5k
views
How do I check if the three last characters of a variable match another variable?
I have %var1% and %var2%
var1="UserInput"
var2=file.log
If a user types %var1% as "file.txt", how can I (if possible) check only the three last characters (Or the file format if that's possible) to ...
0
votes
1
answer
1k
views
How to add variable to PATH system variable? [duplicate]
I am trying to add to my Windows 10 a new folder to my existing PATH system variable.
But I'd like to add it as a nested variable.
So what I did was:
Create a variable for my folder as a system ...
6
votes
1
answer
14k
views
Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set
When I try to create my project's Javadoc in IntelliJ IDEA using Maven, the following error appears:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:javadoc (...
15
votes
1
answer
4k
views
I changed my "HOME" variable and now cannot find "~/.bash_profile" to change it back
I was messing around with environment variables on my Mac, trying to learn how to use them and I used the command nano ~/.bash_profile where I then added the line HOME=/Users/MyCompName/Desktop to ...
0
votes
1
answer
9k
views
Editing System Environment Variables is allowed only when opened through Control Panel
On Windows 10, if I open the Environment Variables window directly through Windows Search, I can't edit the System Variables (buttons are disabled):
However, opening it through Control Panel (Control ...
0
votes
0
answers
49
views
Command prompt. Is it possible to create a certain number of variables according to the lines in a text file and then
Can we use a text file to set variables according to how many changing lines are there in the .txt file?
files.txt
name 1
text 2
info 3
... and so on
set line01="name 1"
set line02="text 2"
...
1
vote
1
answer
25
views
Setenv list edit Centos 5.11
Been looking for an answer but nothing seems to give me a simple one-liner answer (I am not a computer genius).
I want to edit one of the variables (I see them with setenv commant) on a centos 5.11 ...
1
vote
1
answer
225
views
How can I store a Powershell variable's value as a string while creating ISE submenus
I can't seem to articulate my issue well enough within the search engines to find the answer I'm looking for, so I turn to the community for help:
I want to populate my Powershell ISE's menu with ...
0
votes
3
answers
4k
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\...
14
votes
2
answers
3k
views
Unix environment variables with arguments
I'm trying to set my $EDITOR variable to be emacs with no window, so the command to call it would be emacs -nw. However if I set it like this:
export EDITOR="/Applications/Emacs.app/Contents/MacOS/...
28
votes
7
answers
10k
views
What is the simplest scriptable way to check whether a shell variable is exported?
For some shell sessions I want to be able to print a warning flag if a shell variable is not set and exported.
It is fairly simple to do something like this to print "Error" in the prompt if SET_ME ...
27
votes
3
answers
18k
views
Prevent Windows System %PATH% from being prepended to user %PATH?
I know how to set system or user specific environment variables:
Now, the problem is that the PATH variable is treated such that the value you enter for the user PATH will be automatically appended ...
1
vote
1
answer
3k
views
The function of the %configsetroot% system variable in Windows
When I checked my PC, the %configsetroot% system variable was set to the path: %SystemRoot%\ConfigSetRoot
But the weird thing is that the directory as indicated by that path doesn't exist. The ...
0
votes
1
answer
324
views
Editing Environment Variables
I have been able to edit the environment variables in the past in Windows 7 by selecting “Advanced system settings” and clicking on “Environment Variables” and selecting a variable – in particular, ...
40
votes
5
answers
5k
views
Does the Windows Command Prompt search somewhere other than those locations specified by the PATH variable when launching application programs?
I tried the following experiment.
Before I start, I checked the PATH variable from cmd, which has the following value:
Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS ...
0
votes
1
answer
1k
views
Why is Eclipse/m2e not using my computer's PATH when executing command line Maven tasks?
My project uses a Maven build system, and the Maven build includes a command line call to thrift to compile some files.
In bash, mvn generate-sources successfully completes.
But when I use m2e's Run ...
1
vote
2
answers
2k
views
Set environment Path Windows 7
Trying to add stuff to the system environment Path via batch, vbs or anything really.
This used to work in a .bat, but has stopped:
setx -m path "C:\addtopath;%PATH%"
This used to work in VBS, but ...
4
votes
2
answers
9k
views
Setting environment variables in cmd has no effect [duplicate]
I'm trying to set up paths to VS tools to run them in command line, as per https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx
I run vcvarsall x64 from elevated command prompt and check the ...
1
vote
1
answer
2k
views
Environment variables only work if I launch the application from terminal
I recently got a MacBook and I'm doing some programming with Eclipse. I need to use Amazon S3, so I needed to set my credentials as environment variables.
I typed vim ~/bash_profile and added the ...
2
votes
1
answer
19k
views
How to fix $PATH environment on Mac OS X? [duplicate]
Recently, I tried to install ruby and I somewhat messed up with variable environment. As a result, I am not be able to use paths in .profile or any other path files that I set up before (I tried in ....
1
vote
1
answer
1k
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
1
answer
624
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
1
answer
80
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
1
answer
1k
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 ...
1
vote
1
answer
1k
views
Alternative ways of passing PS1 env variable into Ubuntu for SSH session
I know that there are twenty thousand answers, none of them worked as expected, I'm more surprised than you are, so please consider reading the story first.
I'm trying to achieve what appears to be a ...
1
vote
1
answer
3k
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):
...
13
votes
1
answer
20k
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
1
answer
2k
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 ...
1
vote
0
answers
3k
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
1
answer
2k
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 ...
3
votes
1
answer
21k
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
0
answers
40
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
1
answer
191
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 ...
2
votes
1
answer
464
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
0
answers
678
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 ...
2
votes
1
answer
4k
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
2
answers
66
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
1
answer
1k
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 ?
2
votes
0
answers
529
views
Show the %username% for the logged in user in an elevated command prompt instead of elevated users %username%?
On a Windows Vista Business machine, I have Windows Task Scheduler task set to run everytime any user logs in. The task runs as a certain elevated admin user because the script is being executed from ...
0
votes
2
answers
377
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
...
13
votes
10
answers
9k
views
$PATH in Vim doesn't match Terminal
I'm using MacVim and when I don't launch it from the Terminal (mvim) its $PATH does not include what I have set in my .bash_profile. It only seems to have the default values, /usr/bin:/bin:/usr/sbin:/...
2
votes
0
answers
217
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 ...
3
votes
4
answers
71k
views
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name
I have a batch file which starts the Oracle Services
net start OracleOraDb11g_home1TNSListener
net start OracleServiceORCL
call C:\app\Edifixio\product\11.2.0\dbhome_1\BIN\emctl.bat start dbconsole
...
13
votes
4
answers
13k
views
$PATH is filled with duplicates
I recently started configuring a OSX 10.7 environment for development. I've installed HomeBrew, and added the following to my .bash_profile:
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH" ...
0
votes
2
answers
1k
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 ...
6
votes
3
answers
41k
views
On windows 7 admin can't change environment variables and virtual memory,etc
Yesterday I want to set up a web server on my computer.After installing some software(probably MySQL cause the problem,I think),there is an odd problem with my Windows 7.
I'm an admin user,but now I ...
0
votes
1
answer
2k
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
# ...