A set of dynamic variables that can affect the running processes.

learn more… | top users | synonyms (1)

3
votes
1answer
84 views

Difference between logname and $LOGNAME

While reading about environment variables, the one I came across was LOGNAME, I'd like to know the difference between this variable and whatever the command logname returns - as both of them did ...
2
votes
3answers
108 views

Trying to understand .bashrc, env, and export

Disclaimer: Using bash. I just need some confirmation / correction on my understanding of these things: env is basically displaying the current environmental variables that are accessible to my ...
0
votes
1answer
29 views

Make exported path effective immediately?

I'm using a script to export a path like this: echo "export MONO_PATH=~/turbo/" >> ~/.profile; So from now on, the path will be available whenever the user logs in. However, I want to the ...
2
votes
1answer
137 views

Set environment variable (TZ) for all startup scripts and inittab

I'm working on an embedded Linux system and looking for a way to set the time zone for all processes. The question is: Is there any possibility to set the TZ environment variable at boot time (init ...
2
votes
2answers
60 views

How to store the printout of the last command in a shell variable in urxvt/zsh?

I'd like to have the printout (stdout and stderr) of the last command run within zsh available in a variable ready to use grep, etc on it.
0
votes
1answer
22 views

Conditionally command line export variable

If I run export COMMAND=nonexistentcommand && which $COMMAND >/dev/null || \ (echo "download filewithcommand.sh" && export COMMAND=./filewithcommand.sh) echo "command: $COMMAND" ...
2
votes
2answers
29 views

Why some scripts use export for system variables? [duplicate]

I see many online tutorials for ubuntu, and some of them are using export= in the beginning of the script for system variables. for example: export JAVA_HOME=/usr/local/java/jdk1.8.0_05 export ...
5
votes
3answers
134 views

bash script's temporary value on command

Like below command, if true; then IFS=":" read a b c d e f <<< "$test" The book says when value assignment command (IFS ":") is used before main command(read a b c d e f <<< "$...
0
votes
1answer
69 views

env -i and bash-c

Can someone please help me understand the difference between bash -c 'echo $SHELL $HOME $USER' and env -i bash -c 'echo $SHELL $HOME $USER' I tried going over it many times but I still don't get ...
3
votes
1answer
145 views

Bash script can't locate perl module

I have a shell script which isn't running menutray on i3 startup. Line in .i3/config: exec ~/.i3/i3-scripts/menutray.sh This is what I tried for debugging: #!/bin/bash menutray -i -u -r &>/...
1
vote
0answers
37 views

automating variables [closed]

I would like to automate variables in a script that contains access to a library. The library has certain outputs that I want to compare. The following is an example of the variables that I want to ...
1
vote
1answer
78 views

CentOs 7 CronTab set JAVA_HOME

With the root user I configured the JAVA_HOME variable for crontab like this: [root@localhost ~]# vim /etc/crontab _______ SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/jdk1.8.0_71/bin ...
6
votes
1answer
244 views

Setting a IFS for a bash script

The typical case is IFS= read. The subject is very well explained in this thread: why is setting a variable before a command legal in bash? In order to have a complete picture, I'd be very grateful if ...
0
votes
1answer
35 views

how can we change the DISPLAY variable in linux [closed]

What is the command to change the DISPLAY display variable in Linux, because while installation of a program I am getting the error as in the attached screen shot, so please help me how to get it out ...
2
votes
1answer
37 views

How to set environment variables on server/client?

On some workstations (Debian & Ubuntu) and on a server (CentOS) I need environment variables for some scripts and jobs. What I did was altering ~/.profile: SOMEVARIABLE=/some/custom/path ... Is ...
1
vote
1answer
38 views

How to assign a variable within a pipe

I'm building a one liner in bash. If making a script or writing temp files were an option, I wouldn't need to ask. I need to assign a variable in the middle of a set of pipes to use down the line. ...
2
votes
1answer
39 views

The environment given to a program vs the execution environment in which the program is invoked

Bash manual says When a program is invoked it is given an array of strings called the environment. This is a list of name-value pairs, of the form name=value. What are the relation and ...
0
votes
2answers
47 views

Which location does shell assign normal variable?

As you know, bash shell itself is also process. If I use command export a=c, then shell dynamically allocates variable a into location where environment variables are reside.(This environment section ...
1
vote
0answers
80 views

Setting the LANG environment variable for xfce

I am on a multi user Debian Stretch system which has en_US.UTF-8 as default locale, but I want de_DE.UTF-8 for my user. I was able to set it for terminals, by adding export LANG=de_DE.UTF-8 to ~/....
0
votes
2answers
60 views

Correct way to set PERMANENT environment variables from script

I want to do a very simple install process for my app framework. I've got everything working, but I want to set two environment variables. I want to update the PATH and also set a HOME variable. I ...
0
votes
0answers
27 views

Run VNC at startup as root - HOME variable not being set

I have the following code in /etc/init/vnc.conf (used by Ubuntu 14.04's Upstart): description "VNC on start" author "user129013" start on runlevel [2345] exec /root/vnc The job is running ...
0
votes
2answers
133 views

bash command to print gcc environment variables

Is there a way to print all the GCC environment variables(path for include directory, library) from the command line, i.e something similar to 'printenv' that gives all bash environment variables ?
2
votes
2answers
61 views

Why does .pam_environment not include $HOME in my new path?

I created a /home/myname/.pam_environment file containing PATH DEFAULT=${PATH}:${HOME}/apps/flyway But my new path doesn't end with /home/myname/apps/flyway. Why not? $ echo $PATH /usr/local/sbin:/...
0
votes
2answers
37 views

$USER environment variable not changed to root

The USER env variable is unchanged after gaining root access. [user1@comp]$ echo $USER user1 Logged in the system as 'user1'. Now check the output after gaining root access. [user1@comp]$ su ...
3
votes
2answers
575 views

Why is #!/usr/bin/env bash not working on my system?

I ran into some issues when running some installation scripts where they complained of bad interpreter. So I made a trivial example but I can't figure out what the problem is, see below. #!/usr/bin/...
0
votes
0answers
16 views

How to edit $PATH? [duplicate]

After searching, I can't still figure out how to edit $PATH. Now its value is: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/hduser/hadoop/bin:/...
0
votes
1answer
72 views

bash: /home/hadoopuser/hadoop/sbin: Is a directory

I am in Ubuntu 14.04 LTS. Based on how to set a Hadoop cluster I am executing this: # Add Hadoop bin and sbin directory to PATH export PATH=$PATH:$HADOOP_HOME/bin;$HADOOP_HOME/sbin where I know ...
1
vote
0answers
36 views

Piping to 'tee' commands prevents changes in environment variables

I have a csh script using which I modify certain environment variables and echo values of these environment variables from within this script. I source this from another script: source "$...
1
vote
0answers
48 views

Setting environment variable using shell script

I am using csh scripts for some automation purpose. I have a number of scripts, and the beginning of all of which I need to set a fixed set of environment variables. |----SCRIPT 1---| |----SCRIPT ...
0
votes
0answers
18 views

Export variable failed when I was compiling NETCDF

I'm compiling NETCDF on Linux. After configure, make,make install, I have already install NETCDF on /disk3/lly/lib/netcdf-4.1.3. Then, using vim ~/.bashrc,edit: export ...
6
votes
1answer
498 views

What is a *.sorted command and why doesn't it work in my bash?

In a Bash Guide for Beginners (sec. 3.2.1.2. Local variables) there is an example command which is supposed to list all of the local variables, that are not in enviromental variables, or so I think: ...
1
vote
1answer
68 views

Setting env variable through script on current session

Is there a possible way of setting env variable through script on current session. I have tried source option. But this works on the shell not through script. here is my script content source /etc/...
6
votes
3answers
227 views

How can I un-export a variable, without losing its value?

Let's say I exported a variable: foo=bar export foo Now, I'd like to un-export it. That's to say, if I do sh -c 'echo "$foo"' I shouldn't get bar. foo shouldn't show up in sh -c's environment at ...
3
votes
1answer
72 views

How bash changes environmental variables on-the-fly?

As we know, it's only possible to change the environmental variable set of a process in some time after the fork() system call and before exec(), e.g. manipulation like this is possible only from ...
2
votes
2answers
652 views

get environment variable by variable name? [duplicate]

For example, I have a variable: env_name="GOPATH" Now I want to get the environment variable GOPATH as if like this: echo $GOPATH How can I get $GOPATH by $env_name?
8
votes
2answers
167 views

Variable assignments affect present running shell

While writing some code I found out that this line: $ TZ="America/Los_Angeles" date; echo "$TZ" Thu Dec 24 14:39:15 PST 2015 Correctly gives the actual time at "Los Angeles" and that the ...
6
votes
2answers
130 views

Strange environment variable !::=::\ in Cygwin

Using Cygwin, I installed Environment Modules by downloading source code, running configure, make, and make install. Every time I run a module command, I get: init.c(718):WARN:165: Cannot set TCL ...
6
votes
4answers
309 views

Assign multiple environment variables to a single variable and expand them on command

Let's say I want to repeat the same string of environment variables before running various incantations of a command if [[ some_thing ]]; then TZ=GMT LC_ALL=C LONG_ENV_VAR=foo my_command elif [[ ...
2
votes
1answer
30 views

Programs don't see fish environment variables

If I set the EDITOR environment variable to emacs in bash, running crontab -e will open the crontab in emacs. When I set it in fish with set -U EDITOR emacs crontab opens with vim. What can I do ...
0
votes
0answers
19 views

How to make versions consistent

I'm using OS X 10.10, and IIRC I've installed bash and other GNU utilities using brew. The output of which bash is /usr/local/bin/bash, and it's version is 4.3, however the env variable SHELL points ...
1
vote
1answer
103 views

How to print the total available space percentage on a specific file system in both linux and solaris?

I've searched for an answer to this question and I found that this command: df /dev/sda1 | awk {print '{(100 -$5 )}' | tail -1 | sed '/s/$/%/g' does the job pretty well on my linux system but I ...
1
vote
0answers
53 views

Tmux has different environment variables? [closed]

I'm on a RHEL 6 system and I recently noticed I was running into proxy issues when running commands in tmux. When I echo $HTTP_PROXY in tmux, I get nothing. But, if I open a terminal on its own ...
1
vote
1answer
230 views

can one use script commands in systemd Environment field?

I've got a docker-compose file that I use to start up several containers for my service. One of these containers requires an environmental variable to be set (the public ip of the server, to be exact)....
3
votes
4answers
59 views

Bash command substition with environmental variable

I have this code in bash #!/usr/bin/env bash DB_NAME=$(CORE_CONFIG=core.config.core_test python -c "from core import config; print config.DATABASE['db_name']") What I actually want is: #!/usr/bin/...
4
votes
1answer
44 views

Is there a way of setting the library search path temporarily

We deploy our application with all the necessary dependencies in one directory. Our application sets LD_LIBRARY_PATH to this location. Some of the libraries (for instance OpenSSL) are also present at ...
1
vote
1answer
42 views

Relation between shell start up processes and environment of parent process

"How are shell variables related to the environment that a process started by the shell has on start-up?" I read If processes inherit the parent's environment, why do we need export? My current ...
0
votes
0answers
33 views

Supervisord fails to run a program

I've a program that I try to run with supervisord but keep failing. The following is supervisord configuration: $ cat /etc/supervisor/conf.d/application.conf [program:application-web-1] command=env /...
0
votes
0answers
135 views

Custom GCC installation - how should I set my environment variables?

After some pains I was finally able to build me a gcc 4.9.3 (I don't have root on the machine I'm working on, and Fedora 22 doesn't package gcc 4.9 anyway). And it even works, i.e. using it to compile ...
3
votes
1answer
169 views

To export or not to export bash PS1 variable

I just spent a lot of time reading up on login and interactive shells and why one should or should not set environment variables, shell functions, etc. in the various profile and bashrc files. In this ...
1
vote
1answer
60 views

Bash - Shell variable gets promoted to environment variable in child bash process

Question In Bash, shell_variable=value bash child_command makes the shell_variable an environment variable in the child_command. Is this a build-in shell (sh and bash) feature to promote a shell ...