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

learn more… | top users | synonyms (1)

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 ...
3
votes
1answer
43 views

Why don't locale variables show up in the output of env or printenv?

The locale command prints a list of environmental variables containing info related to the users locale: $locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" ...
1
vote
1answer
67 views

How do I find the libraries this program needs for its environment variable?

I am trying to set up the program NASAView, for viewing PDS files. The instructions say Set the LD_LIBRARY_PATH Environment Variable The LD_LIBRARY_PATH environment variable is used to ...
1
vote
1answer
434 views

Error when exporting the result of a valid command as a bash variable

I'm trying to export the result of a command line as en environment variable. Here is how I'm doing it: group_id=$(aws ec2 describe-security-groups --filters Name=group-name,Values=${group_name} \ |...
2
votes
1answer
25 views

Make webserver reload the system wide environment variables

I made changes on the /etc/environment file and want the webserver user www-data to benefit from them without rebooting the server. It seems that, in order to reload the /etc/environment file, I only ...
2
votes
1answer
80 views

How to not show path after cd command with CDPATH set?

Setting the CDPATH variable is very useful, but it results in some not very nice result: each time I use the cd command, the full path of directory I want to move is printed. For example, if I am in ...
0
votes
0answers
27 views

Using 'export' and 'xargs' in order to export environment variables from an separate file [duplicate]

I have a dev.env file that contains a number of environment variables. dev.env: APPLICATION_URL=http://localhost:8080 APPLICATION_DOCKER_IP=$(docker-machine ip default) APPLICATION_CLIENT_HOME=../...
2
votes
1answer
63 views

Share environment variables with www-data

I have a set of environment variables, which is created with a shell script config called from my ~/.bashrc. Having a new user www-data running a local webserver (with lighttpd), I need it to benefit ...
0
votes
0answers
30 views

What environment variables to set when building and installing as regular, non-root user?

Scenario: Using GNU/Linux tools, I want to configure, make, and install to $HOME/custom as a regular, non-root user. Are the following Bash environment variables reasonable? export PATH="$HOME/...
3
votes
4answers
150 views

how to use sed when a variable contain '/' in it?

I have the following line to execute in a script and that delete two lines above it. But now my $TEST variable contain values like '/DATA/test10' and my variable ID contain '10'. How can i use this ...
3
votes
1answer
91 views

recreate shell invocation

Does a running shell have a mechanism to recreate its invocation? I sometimes make changes to variables or my profile and have to manually source the startup files to make things run again, for ...
4
votes
4answers
302 views

How to show an environment variable's current value?

When I check on my system's environment, a lot of environmental variables will pop up. How can I just search for a particular variable? A book I'm reading says: Sometimes the number of variables ...
1
vote
1answer
578 views

Why does bash clear OLDPWD when a child script is started?

OLDPWD is exported and passed to any children, but bash apparently clears OLDPWD whenever a child script is started: $ cd /etc $ cd $ perl -e 'print "<$ENV{OLDPWD}>\n"' </etc> $ ksh -c '...
6
votes
1answer
280 views

`env foo=bar echo $foo` prints nothing

I think I'm having a massive brainfart. I would expect env foo=bar echo $foo ...to print bar, but I get an empty line instead. Wat. The same happens if I use the bash syntax: foo=bar echo $foo
2
votes
1answer
72 views

Can't vi in single user mode

Forgive my ignorance, but I have the following problem: In DragonflyBSD, I need to edit /etc/rc.conf in single user mode, but # mount -u / # mount -a # vi /etc/rc.conf vi: unknown: unknown ...
1
vote
1answer
247 views

bash set variable with colon (:) and dash (-) in it (as used by lftp)

so lftp uses some weird shell variables, like the following: xfer:log-file = 1 sftp:connect-program = “ssh -a -x -i keyfile” how would I set these variables? I've tried using set, and env; as well ...
1
vote
2answers
159 views

Arrays in Zsh. Check if any of the following variables is not defined

Say we have a set of variables that we want to test if they are defined, and set a condition if any of them are not. I am thinking of proceeding with something like the following: #!/usr/bin/env zsh ...
2
votes
1answer
140 views

Preserve OLDPWD after logging out

I often need to go to the directory I was when I logged out of a server. I habitually use cd - for this purpose. However, after logging out and logging back in this does not work because apparently ...
1
vote
1answer
350 views

How to pass environment variables to a new ssh-initiated login session?

Suppose that some variable FOO is defined (and export-ed) in the current environment. Let me call this environment E0. Now, I log into some other Unix system using ssh. % ssh frobozz@for.example....
0
votes
0answers
237 views

JAVA_HOME set to /usr/lib/jvm/jdk1.8.0_60, yet when running java it does not work?

I needed to set JAVA_HOME and DATABASE_HOME to install Adempiere, so I did it by editing .bashrc as shown here, and then restarting virtual machine. [Linux version is Ubuntu 14.04.3]. When I run ...
1
vote
2answers
157 views

Makefile include env file

I'm trying to include some env vars into a Makefile. The env file looks like: FOO=bar BAZ=quux Note there's no leading export to each env var. If I add the leading export and just include the env ...
3
votes
2answers
88 views

Get environment variables of running session

Yes, I know that this question is a bit confusing, I just mean "the variables which are acessible from session's command line". I am writing an application which runs automatically by upstart on ...
0
votes
1answer
33 views

Restrict unix user from setting environment variables during the active session

I've a condition in which I want to restrict a unix user from setting up environment variables or modifying the environment variables locally during the user's active unix session. For example, if I'...
1
vote
2answers
120 views

How can I use the environment variables inside a regular expression in awk?

#!/bin/sh ALTER="1153" NAME="aio" for i in $(ps -eo pid,etime,comm | \ awk -v alt="$ALTER" -v name="$NAME" '$2~/[^0-alt]-/ && $3~/name/{print$1} '); do echo $i done
7
votes
2answers
291 views

How to prevent the caller's shell from being used in sudo

I'm running sudo-1.8.6 on CentOS 6.5. My question is very simple: How do I prevent SHELL from propagating from a user's environment to a sudo environment? Usually people are going the other way- they ...
3
votes
1answer
90 views

Export a selection of environment variables with correct escaping

I want to export some environment variables which I set in a dash script to a file: myvariable="line 1 LINE=3 some characters: # \" \$ line 5" myvariable2="abc" export myvariable myvariable2 ...
0
votes
1answer
97 views

How to import self made modules in Python on Ubuntu 15.04

I just moved from windows 8 to Ubuntu 15.04. I do some programming in python3, and some programs rely on imports from self made modules. In windows all I had to do was add the directory which contains ...
4
votes
2answers
210 views

Why do `env var=value` allow arbitrary name in var?

Reading env POSIX documentation: Some have suggested that env is redundant since the same effect is achieved by: name=value ... utility [ argument ... ] The example is equivalent to ...
-2
votes
1answer
73 views

How to solve the defining variables in bash prompt command not found the problem

My Linux distributions centeros7, define variables on the bash prompt command not found [wanghao@localhost ~]$ al = nihao bash: al: command not found... [wanghao@localhost ~]$
5
votes
2answers
151 views

Using ~ in symlink target or making a symlink with a variable

I would like to create a symlink to ~/foo/ but when I write that, ~ is always resolved to the absolute home path. I've used ../s in the past and they work fine, is ~ not allowed? The reason I'd like ...
0
votes
1answer
42 views

environment file variable equals another variable [closed]

Is there a way to create an .env file that defines a variable with the value of another variable? I have tried using: var1=$var2 And it obviously doesn't work. Any takes?
1
vote
2answers
88 views

Cannot run command inside bash variable including square brackets with nullglob

Assuming I want to run commnand stored inside the variable with nullglob turned on. For example: shopt -s nullglob a="echo [foo]bar" ${a} This gives me an empty output due to the nullglob option of ...
1
vote
1answer
73 views

Indirectly expand variables in shell

I need to indirectly reference a variable in the bash shell. I basically want to what you can do in make by writing $($(var)). I have tried using ${$var} which would be the most straight forward ...
1
vote
2answers
71 views

use an export variable as part of filename in awk program

I have set an export X25DATAF=/home/Bob/X25/Datafiles in my profile and that's what is outputted when I do a echo $X25DATAF. I want to replace /home/Bob/X25/Datafiles in the awk below with the $...
0
votes
3answers
63 views

how to add these 3 lines as enviroment variables to .profile bash file

How do I add these 3 lines into .profile as environment variables: BBSCONFIG /home/tony/majorbbs.cfg BBSDISP xwindow DISPLAY hostname:0.0
0
votes
2answers
81 views

Why does my change in .profile has no effect? [closed]

I have a Red-hat Linux box. I logged in as a user1 and made JBOSS_HOME variable change in .profile file. Previously It was: export JBOSS_HOME="/opt/home/user1/jboss-eap-6.1" Now I changed it to: ...
3
votes
2answers
291 views

Complete view of where the PATH variable is set in bash

I've read in a couple of places that the PATH is set in /etc/profile or the .profile file that's in the home dir. Are these the only places that the path is set in? I want a better understanding of ...
1
vote
1answer
76 views

Why isn't “export” permanently chaning my environment variables?

Running Fedora 20. Trying to permanently set the LANG and LC_TIME variable with "export". When I run it, it works fine and I can see it was changed. When I reboot, it gets changed back. I am doing all ...
4
votes
1answer
271 views

LD_LIBRARY_PATH environment variable

I am trying to test the LD_LIBRARY_PATH environment variable. I have a program test.c as follows: int main() { func("hello world"); } I have two files func1.c and func2.c: // func1.c #include ...
0
votes
1answer
73 views

How to create a module on a CentOS cluster [closed]

I would like to create a module on a CentOS 6 cluster (e.g. module load gcc-4.7.2). Basically, I have no clue how modules work. Are there any good tutorials illustrating this or could someone ...
0
votes
0answers
18 views

Environment Variable not Exporting [duplicate]

I have this script that I'm writing, basically as my own free dynamic dns system (with a bit more manual-ness at the moment). Here it is: #!/bin/bash VPN_FILES_URL=http://routerlogin.net/nonwindows....
0
votes
1answer
115 views

Pass environment variables to clean chroot in Arch

I am writing a PKGBUILD for Arch Linux. The package is large and compressing/uncompromising it take considerable time for limited space savings and I would like to turn it off while I am writing the ...
0
votes
0answers
99 views

How do I send a variable through SSH so it can be used across servers? C Shell

EDIT: Would this be possible in bash? Note: I have to use C shell. (.csh) I have something very similar to the following code: set var = "string" ssh -X server "$var" << END * I ...
0
votes
4answers
230 views

Unable to add folder to PATH in .profile file

The following is my .profile file: # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see /usr/...
4
votes
2answers
282 views

Where is the `$TERM` environmental variable set in Debian Jessie for console logins?

I have read a lot of articles and SE questions regarding how and where the default $TERM environmental variable gets set. Unfortunately in Debian 8.1 I can't seem to find where the default $TERM ...
0
votes
2answers
42 views

How to pass an environment variable when change rooting?

I don't seem to be able to pass an environment variable to a chroot: $ sudo apt-get install debootstrap dchroot $ sudo debootstrap trusty mychroot $ sudo chroot mychroot /bin/bash -c "MY_VAR=5; echo $...
0
votes
1answer
275 views

Bash - check environment variables

The env command can be used to print environment variables in bash. I want to ask if there is any built-in command to do this ? $ export temp="hello world" $ env | grep temp The second command ...
2
votes
1answer
220 views

Bash - shell vs environment variable [duplicate]

I want to clarify a confusion I am having in shell variable vs environment variable. I did the following test, where I have a shell variable abc and export it to an environment variable. $ $ abc="...
1
vote
1answer
793 views

How set environment variable permanently in Red Hat Linux?

As I'm using Red Hat Linux 5.3, I'm unable to set environment variable permanently. I want the file names for csh, from which I can add the environment variables permanently.
-1
votes
1answer
169 views

How can I delay the evaluation of variables (lazy evaluation)?

For example, I create 32768 directories named 0,1,2,...32767. I want to randomly choose one as the path every time I run a command. So I change $PATH to $PATH:/blabla/$RANDOM, but it won't work ...