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

learn more… | top users | synonyms

4
votes
2answers
670 views

How to add a path to system $PATH for all users's non-login shell and login shell on debian

I installed some programs in /opt/my-program/bin, I wanted to add /opt/my-program/bin to system $PATH for all users's non-login shell and login shell. What should I do? Changing /etc/environment is ...
4
votes
2answers
278 views

Inhibit Variable Expansion in Paths

How do I prevent Zshell (and Bash I assume) from expanding environment variables in paths be completed as shown in the following example: $PREFIX/alt/li should expand to $PREFIX/alt/lib and not ...
11
votes
2answers
2k views

How to run a program in a clean environment in bash?

I want to run a program in an empty environment (i.e. with no envariables set). How to do this in bash?
4
votes
2answers
1k views

Change user and load entire environment in shell script

I'm having some trouble with an upstart script of ours that changes user and starts up a few ruby daemon processes. In the past i would simply bash -c "do the business" -l someuser making sure to use ...
3
votes
1answer
264 views

Environment settings on setuid executables

I am observing a curious behavior when running a program with setuid bit enabled. Program foo is owned by user bar with setuid bit set. User execbar runs foo foo reports that one of the dynamic ...
2
votes
2answers
721 views

Sharing Variables across sub shell scripts

I have a Main shell that runs a profile, The profile contains some variables such as Count. When I call the main shell, it loads the profile and then call another shell script. I want that inner shell ...
4
votes
3answers
4k views

How to add a path to system $PATH for all users's non-login shell for debian

After installing some programs in /opt/xxx/bin, I want to add /opt/xxx/bin to system $PATH for all users's non-login shell. What should I do?
2
votes
1answer
1k views

export PATH only once per login in zsh

I need to alter my PATH variable so I put export PATH=$PATH:somedir in my $HOME/.profile which is sourced by my $HOME/.zshrc. This works, yet whenever I open a new terminal (urxvt in X11), .zshrc ...
3
votes
0answers
217 views

assigning a multiline variable (tcsh prompt) to another

For tcsh, I have a prompt that is multiline: set prompt = "%/\\ %n@%m[%h]% " This shows the cwd on one line and then the user/host on second line. However, with this, I cannot make a copy of that: ...
4
votes
2answers
6k views

How to export LD_LIBRARY_PATH to all users and system services

I want to export LD_LIBRARY_PATH to system services and all users. System services are run before login, so .bashrc is not applicable. How to achieve this?
10
votes
1answer
263 views

How do you set up the environment for es?

I've been playing with es the last couple of days, and it (like rc) has the quirk/feature that it only runs its startup script (.esrc) on login. The usual way to run code in each interactive session ...
2
votes
2answers
1k views

How to automatically add new path to $PATH variable after RPM packet installation?

I want to automatically add a new path to the $PATH variable each time when my RPM package is installed. I tried to use a post installation script in the my RPM. Here is the part of RPM spec file ...
7
votes
3answers
1k views

Why $SHELL doesn't change when I run new shell?

$ echo $SHELL /bin/bash $ /bin/ksh93 $ echo $SHELL /bin/bash $ file /bin/ksh93 /bin/ksh93: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for ...
0
votes
2answers
554 views

How to set environment variables permanently for one user [duplicate]

Possible Duplicate: How do I set a user environment variable? (permanently, not session) I have a user XX and I want to set the env variables for it. I looked for .bash_profile in the home ...
3
votes
1answer
4k views

How to make unix service see environment variables?

I have set my environment variable using /etc/profile: export VAR=/home/userhome Then if I do echo $VAR it shows /home/userhome But when I put reference to this variable into the ...
1
vote
1answer
954 views

Why .bash_profile couldn't set PS1 variable?

I set .bash_profile to exec env -i HOME=$HOME TERM=vt100 PS1='\h' /bin/bash But when I login, it also show: lfs@sam:~$ env TERM=vt100 PWD=/home/lfs ...
1
vote
1answer
63 views

Why lfs couldn't use original host environment variables?

From the lfs doc: The exec env -i.../bin/bash command in the .bash_profile replaces the running shell with a new one with a completely empty environment, except for the HOME, TERM, and ...
5
votes
1answer
1k views

How does 'screen' impact environment variables?

I noticed a difference in 'env' before and after a 'screen' call, is there any additional clarity on what gets called (for setting environment variables)? I couldn't see any clear explanation from ...
3
votes
2answers
840 views

How to change environment variables without re-logging to UI?

How can I change environment variables without re-logging to UI? I want to re/define some variables and want them set on my current logged in shell (including UI). I know logging out and then logging ...
6
votes
2answers
378 views

Run a script automatically as I switch to a directory [duplicate]

Possible Duplicate: Execute bash scripts on entering a directory I am running an environment which requires some very specific tool versions. The commands to set up the environment are in a ...
14
votes
2answers
7k views

How do I change the default text editor in the Debian (squeeze) distro

"Joe's own editor" does not come naturally to me. How do I change to using nano or vim? I've tried export EDITOR=nano but it doesn't seem to be respected. I'd like visudo to respect this as well.
2
votes
1answer
1k views

How can I set environment variable permanently through shell script?

Let's say I have a script: #!/bin/bash echo $1 if [[ ! $1 ]];then echo "True" fi export ABC="/home/aashish" ABC is not available after the execution of this script. How can I make that variable ...
1
vote
2answers
9k views

changing an environment variable like PATH forever [duplicate]

Possible Duplicate: How do I set a user environment variable? (permanently, not session) to change the amount of PATH variable , I use : export PATH=... but when I close the terminal, the ...
1
vote
2answers
10k views

How to set environment variable JAVA_HOME that will be saved on exit? [duplicate]

Possible Duplicate: How do I set a user environment variable? (permanently, not session) I use Suse. First was installed jdk7, so JAVA_HOME remains like: /usr/java/jdk1.7.0_05/ After I ...
1
vote
1answer
150 views

crontab sets up user variable, redirect output, and detect connetcted network

I have three problem, all of them are about crontab. Can I access $HOME variable in crontab ? for example, use $HOME like this: PATH=$HOME/bin:$HOME/scripts:$PATH ? or * * * * * echo "test" > ...
3
votes
1answer
743 views

How do you make DISPLAY variable undefined?

I am using Ubuntu, but I think this applies to all Linux. What's the command to set DISPLAY to be undefined in the shell?
2
votes
3answers
650 views

How can I restore the changes to shell variable?

For the purpose of an experiment... Suppose I did this bash="unset DISPLAY; export DISPLAY" so I can make DISPLAY undefined. How can I restore the original value set? Or at least know what it was? ...
13
votes
2answers
6k views

What is the difference between ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc …?

Answers to the questions on SO and askubuntu, along with poking through (and reading headers of) $HOME and /etc/, indicate a number of files that can be used to set environment variables, including: ...
2
votes
2answers
302 views

What is the difference between `terminator -e ranger` and ranger from terminal?

EDIT: I just noticed that when I hit Enter on the ranger (if it is executed with terminator -e ranger) then nano opens while with e it uses my main editor. In contrast, when I use a normal shell to ...
3
votes
2answers
1k views

How can I expose JAVA_HOME to applications running under X and/or Gnome?

I'm trying to run IntelliJ from Gnome3's Applications menu, but it complains the JAVA_HOME variable is not set. I have the Java installation under my home folder. I managed to export the variable in ...
6
votes
1answer
917 views

change environment of a running process

How might it be possible to alter some variable in the env of an already running process, for example through /proc/PID/environ? That "file" is read-only. Need to change or unset the DISPLAY variable ...
0
votes
1answer
203 views

Fedora 7 server export in .bashrc not getting set [duplicate]

I'm trying to set the JAVA_HOME environment variable in my .bashrc but every time I log back in it gets unset again to its original value, below is my .bashrc file # .bashrc # User specific aliases ...
2
votes
0answers
72 views

Envirnment variables for packages built in custom location

Some time ago (month or so) I started to install packages that I build from source in custom location ~/.local so that I can easily distinguish which I build from source, and for other reasons, ...
1
vote
1answer
1k views

Setting locale for user

I'd like to set a locale for my user different than system locale. By putting export LANG=en_US.utf8 in .bashrc I could do that for the shells, but still it's not working for applications not started ...
3
votes
2answers
989 views

sourcing a file inside a script

I'd like to source a file inside a tcsh script. In code: #!/bin/tcsh unsetenv LD_LIBRARY_PATH source $1 echo $LD_LIBRARY_PATH > temp_file The expected result: The environment variable set ...
1
vote
3answers
395 views

Accessing bash [internal] brace expansion iteration number/variable

Question: Is it possible to access which number of a bash iteration is currently being processed? Psuedo-Command mv {1..5}.something.{1..5} $x1.$x2.something Note: This is a logical ...
0
votes
2answers
105 views

Way to determine where certain global parameter is configured [duplicate]

Possible Duplicate: How to determine where an environment variable came from I wonder if there is a way to determine the location of the file where certain configuration exists. For example ...
0
votes
2answers
2k views

Trying to set JAVA_HOME in ~/.bashrc

I have added this line at the end of ~/.bashrc export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java But when I execute echo $JAVA_HOME, I don't get anything as output, I expected ...
1
vote
2answers
2k views

How to make changes to /etc/profile take effect

I am trying to change $GRAILS_HOME from /usr/grails-1.3.7 to /usr/grails-2.0.0 If I just do export GRAILS_HOME=/usr/grails-2.0.0 it doesn't persist when I log out and back in. I found a line in ...
1
vote
1answer
232 views

Why `which tmux` and `sudo which tmux` return 2 different values?

ssh bobby@tony:~$ which tmux /usr/bin/tmux ssh bobby@tony:~$ sudo which tmux ...
1
vote
4answers
410 views

Exporting environment variable

I am having some problem with bash. I want to export an environment variable whose value contains a variable but I don't want that variable (which is within the value) to be evaluated during the ...
1
vote
2answers
202 views

Variable name from command output

I have some string, and want to split on colon ":" assigning on variable with name from left part and value from right part. For example: echo "Title: Some title" | sed 's/:.*//' gives me wanted ...
7
votes
1answer
268 views

How set environment variable based on whether a GUI is available?

How can I set up my .bashrc such that the value of an environment variable changes based on whether or not the current session has access to the gui / windowing system? For example, let's say I have ...
0
votes
1answer
266 views

Shell script executing in the terminal but not from shell script file [duplicate]

Possible Duplicate: How can I make variables “exported” in a bash script stick around? I have a problem with executing script from file. When I type in command line ...
1
vote
2answers
393 views

Checking if PATH contains $HOME/mydir and adding it if not (all in a script) [duplicate]

Possible Duplicate: keep duplicates out of $PATH on source I am not an expert with Unix scripting. Some of my scripts are located in $HOME/mydir. Unfortunately, they are not accessible from ...
5
votes
2answers
3k views

Set Variable Environment Variables in bash (or other)

I want my script to read a file containing key/value pairs of environment variables to set, and then to set them. So far, I have this: #!/bin/bash cat $1 | while read kv do key=${kv%=*} ...
6
votes
4answers
2k views

Adding paths to PATH using a multi-line syntax

As far as I understand, the usual way to add a path to the PATH environment variable is by concatenating paths separated by the : character. For example, if I want to add three paths to it ...
11
votes
2answers
3k views

In zsh how can I list all the environment variables?

I want to get a list of all environment variables (shell variables? exported variables?) and their values at a given time, in zsh. What is the proper way to do this?
7
votes
1answer
1k views

How can I make variables “exported” in a bash script stick around?

I have multiple Amazon EC2 accounts and want to quickly be able to switch variables, such as $EC2_HOME, using a script. I have have a shell script set up like this: #!/bin/sh export ...
9
votes
2answers
4k views

.bash_profile not sourced when running su

I have a user, say user1, which has modifications to its .bash_profile, one of them changing the PATH, e.g.: export PATH=/some/place:$PATH. This change works fine if I log on as user1 or do a su - ...