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

learn more… | top users | synonyms

2
votes
3answers
5k views

Storing a list in a variable

I am trying to store the name of list of files that contain 781 in their name. I will be using this list to perform some operations and after that I will delete this list. I have two options to do ...
0
votes
1answer
438 views

difficalty to save traceroute output in shell variable?

I need to filter and store traceroute output in shell variable (array). But I am getting some unusual output. As I try to explain in following lines. My present directory is temp, having some ...
2
votes
2answers
1k views

What is the difference between '.' and 'source' in shells? [duplicate]

Possible Duplicate: running script with “. ” and with “source ” I have used both the dot command '.' and 'source' to reload a given rc file (typically to update my environment variables) ...
3
votes
2answers
926 views

Environment variable set but not respected

I find the following behavior a little confusing, can someone please explain why it happens? In /etc/bash.bashrc I have: EDITOR=vim And it is indeed set: lev@home ~ $ echo $EDITOR vim I would ...
5
votes
1answer
716 views

Difference between environment variable and shell variable

It is said that environment variables are inherited in child processes but shell variables are not. However the following test shows shell variables are seen in child process just as environment ...
3
votes
1answer
490 views

Why can I only use apt-get when I use “su”?

Not sure what info you need here, if any. Just let me know. I have a proxy that bypasses the corporate net set in my profile file for both su and normal user. When I do a sudo or regular apt-get ...
2
votes
2answers
101 views

Can I change the shell used to run GUI applications from a Desktop Manager?

A bit of background I'm a developer and I install most of my tools in my home folder. So my shell's rc file is full of JAVA_HOME, GROOVY_HOME, MAVEN_HOME, ... variables. To expose all these ...
1
vote
0answers
37 views

Modify environment variable in a running process [duplicate]

Possible Duplicate: change environment of a running process Is there a trick to modify an environment variable in a running process? I need to add a repository at the end of PATH. I have ...
8
votes
2answers
731 views

Interactive shell with environment identical to cron

I am aware of a lot of pitfalls in the magic world of crontabs, but sometimes it would help troubleshooting a lot when you have some smart way to enter an interactive (bash) shell with exact identical ...
11
votes
3answers
20k views

How do I set an environment variable on the command line and have it appear in commands?

If I run export TEST=foo echo $TEST It outputs foo. If I run TEST=foo echo $TEST It does not. How can I get this functionality without using export or a script?
2
votes
1answer
114 views

Is there a way to define the preferred merge or diff tool under Unix?

I know that you can define the preferred editor by setting the EDITOR environment variable. My question is if there is a similar solution for setting the preferred merge or diff tool.
10
votes
2answers
1k views

How can I create a clean shell environment for temporary use?

I am a frequent answerer on a Unix-focused popular Q&A site, and in many of my answers I provide examples using the bash shell. However, each time I do this I have to manually go through the ...
3
votes
0answers
119 views

tab-expansion and “./” bash shell [closed]

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is ...
2
votes
3answers
286 views

What is the difference between ./script and . ./script? [duplicate]

Possible Duplicate: Using ‘.’ to execute files in bash I was trying to figure out how to export my environmental via script instead of changing my .bashrc file. I found this old useful ...
4
votes
3answers
1k views

Bash shells with different environment variables

I want to somehow enter a different bash shell with some altered environment variables. For example, if I run script bfin.sh and it contains something like export PATH=/home/me/bfin2012:$PATH I ...
0
votes
1answer
996 views

Setting up enviroment variables in Ubuntu

I am trying to setup up my enviroment variable in my Ubuntu machine. Now i did some research and tryed the method on this question Set environment variable in Ubuntu Similar question but the thing is ...
0
votes
2answers
1k views

$PATH in /etc/profile not inherited by user shell

I have this in /etc/profile in Fedora 17: PATH=$PATH:"/usr/pgsql-9.2/bin" EDITOR="/usr/bin/emacs -nw" PSQL_EDITOR="/usr/bin/emacs" PAGER="/usr/bin/less" export PATH USER LOGNAME MAIL HOSTNAME ...
4
votes
2answers
1k 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
341 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 ...
18
votes
3answers
5k 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
3k 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
457 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
1k 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
6k 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
276 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
10k 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
278 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
2k 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 ...
9
votes
3answers
2k 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
789 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 ...
8
votes
2answers
7k 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
1k 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
75 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
2k 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
1k 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
558 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 ...
21
votes
2answers
14k 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
2k 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
13k 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
16k 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
174 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
1k 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?
3
votes
3answers
972 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? ...
23
votes
3answers
10k 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
348 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 ...
5
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 ...
8
votes
1answer
1k 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
225 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
82 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, ...