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

learn more… | top users | synonyms

3
votes
2answers
330 views

What is $PWD? (vs current working directory)

So Wikipedia (link) tells me that the command pwd is short for "print working directory", and that makes sense. But for the environment variable, the "P" has to be an acronym for something else than ...
1
vote
0answers
19 views

systemd: default value for environment variable

I would like to migrate some OpenRC init script to systemd but I think that it is general problem of environment variables handling in systemd. Original OpenRC files There is a file e.g. ...
0
votes
1answer
35 views

Issue due to scope of environment variables

I had an Internet connection problem which turned out to be related to setting up the appropriate proxy environment variables. After adding lines like export ...
0
votes
1answer
31 views

Remove a folder with the same name as an environment variable

I was messing around with a log4j properties file and accidently made a folder with the following text ${foo} however I also have an environment variable named foo that points to a folder so thus if I ...
1
vote
3answers
3k views

Get environment variable of other user [closed]

Is there a way I can see the environment variable of an other user? I want to do that as root, so permissions won't be a problem I guess. For the user himself, I use echo $PATH or set | grep PATH ...
2
votes
1answer
72 views

clear out all variables without closing terminal

I want to know how to clear all variables which I defined in command prompt without closing terminal ? for example, if I set a variable in command prompt as: $ a=1 now I want to delete the ...
1
vote
3answers
71 views

How long do the contents of the .bash_history file last?

How can I modify the contents of my bash_history file? What values or variables control how long the history lasts? Are there any other things I can change to provide finer control of my BASH ...
5
votes
5answers
18k views

Export an env variable to be available at all sub shells, and possible to be modified?

Suppose I have export MY_VAR=0 in ~/.bashrc. I have an opened gnome terminal, and in this terminal, I change $MY_VAR value to 200. So, if I do echo $MY_VAR in this terminal, 200 is shown. Now, ...
1
vote
2answers
23 views

Why is $COLUMNS not listed by either env or set? (on zsh)

I can $ echo $COLUMNS 95 and get a result, but if I env | grep COLUMNS or set | grep COLUMNS I get nothing. (Update: I just discovered that the behavior is different on bash. I'm using ...
1
vote
1answer
78 views

Storing longer text output in memory in shell variables vs Writing to disk

I have the below call to db2 command line tool inside a loop which runs 100k iterations. (the db2 output is 5 rows of 20 chars approx per each call, total of approx 100k calls. The input to SP is ...
8
votes
2answers
5k views

Who sets $USER and $USERNAME environment variables?

Also, will these variables always match currently logged-in username (they do on my Debian system)? Can I assume their availability in other Unix(-like) systems? I'm also curious why one would use ...
0
votes
3answers
928 views

I have an environment variable for LANG set in ~/.profile but it is not getting set

I want to set the locale. I have this in my ~/.profile #language export LANG=en_GB.utf8 export TESTING123=en_GB.utf8 But when I type: echo $LANG $TESTING123 I get (LANG not set, but TESTING123 ...
1
vote
1answer
25 views

Exporting Variables from Read

I'm asking the user to input some data using Read that data will be save on a variable that is going to be use in another shell script. However, for some reason is not working. This is what I got in ...
0
votes
2answers
30 views

How can I expand all variables at the command line in Zsh?

In an earlier question, specific to bash, I asked How can I expand a relative path at the command line, with tab completion? I liked @Mikel's answer that mentioned using Ctrl+Alt+e to expand all ...
13
votes
1answer
232 views

Is there a difference between prepending a name-value-pair to a command and using env in bash?

Let's say I invoke A=B command and env A=B command in bash. Is there any situation where there might be a difference between both invokations?
0
votes
2answers
36 views

LD_LIBRARY_PATH always blank after sudo

I get shared library errors whenever I seem to install software manually. Upon executing echo $LD_LIBRARY_PATH it shows up as.. nothing. I've tried adding /usr/local/lib to a .conf file in ...
-4
votes
3answers
48 views

Data Types in UNIX [closed]

I have 2 questions. Q#1: data types & variables I have just begun reading UNIX and came across variable definitions. As per the site I'm referring UNIX variables are defined directly with a ...
3
votes
1answer
226 views

Export multiple options in $GREP_OPTIONS

I use ZSH with "OH MY ZSH". In "OH MY ZSH" variable $GREP_OPTIONS exports with multiple value: $ echo $GREP_OPTIONS --color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg ...
1
vote
3answers
3k views

Removing a directory from PATH

I'm trying to compile wxWidgets using MingW, and I have cygwin in my path, which seems to conflict. So I would like to remove /d/Programme/cygwin/bin from the PATH variable and I wonder if there is ...
0
votes
2answers
66 views

Percent signs and environment variable in a shell script

While troubleshooting an issue, I came across these entries given below in one of the shell scripts used by our application. This was written by someone who no longer works in the company and I am ...
0
votes
1answer
96 views

Installing netbeans on Scientific Linux- NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread “main”

I'm installing netbeans 8.0.1 on Scientific Linux. I have executed the installer .sh but I get the error: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main" ...
1
vote
2answers
53 views

where is LD_LIBRARY_PATH? how do I set the LD_LIBRARY_PATH env variable?

where is LD_LIBRARY_PATH? how do I set the LD_LIBRARY_PATH env variable?
5
votes
2answers
6k views

“No protocol specified” when running vim with sudo

Recently I start to get "No protocol specified" when using sudo vim. It's just a warning I guess, because everything was working normally (I can open, edit and save files). The message doesn't appear ...
6
votes
3answers
4k 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%=*} ...
1
vote
1answer
44 views

Run an X11 program under Cygwin

How do I set the appropriate DISPLAY environment variable? I try to launch idle in cygwin using the following command: idle ...and I get a display error: _tkinter.TclError: no display name and ...
2
votes
1answer
46 views

Preserve environment variables using systemd?

Do systemd unit files support preserving existing environment variables? (Something similar to sudo -E?) Not referring to Environment= or EnvironmentFile= here. It would be be useful if systemd ...
2
votes
4answers
67 views

Change prompt when starting a terminal from bash script (but don't affect all terminals)

I have two terminals installed, gnome-terminal and xfce4-terminal. I would like to have only the xfce terminal showing a simple > as prompt when I start it. The gnome-terminal prompt should remain ...
2
votes
4answers
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
0answers
11 views

Loading linux environment variables [duplicate]

I have a set of environment variables and i would like to load it automatically on each startup. As of now i am doing the following: In /etc/environment export FLEETCTL_TUNNEL=10.77.189.179 In ...
1
vote
1answer
24 views

several virtual profiles for the same user

Many times there are several "identities" which one user uses: for work, open-source, academia etc., all require different ssh keys, editor configurations, git configs etc. I was wondering if there ...
2
votes
2answers
210 views

Meaning of \ before environment variable

In ksh on an old Solaris box I used: export PS1="$PWD $" to set the prompt to the current directory. It works great until you cd elsewhere, then you see that it's not evaluating PWD each time. I ...
1
vote
2answers
65 views

how to use http proxy in terminal

I have to use a http proxy to access Internet. Now I'm using firefox with the http proxy to access Internet. But on terminal, I can' access Internet. So are there ways to use http proxy on terminal ...
6
votes
2answers
3k views

rkhunter warns me about root.rules

I run : :~$ sudo rkhunter --checkall --report-warnings-only One of the warnings I've got : Warning: Suspicious file types found in /dev: /dev/.udev/rules.d/root.rules: ASCII text and ...
1
vote
1answer
112 views

Why is variable assignment preceding command ignored? [duplicate]

The bash 4.1 manpage states (emphasis added)... Simple Commands A simple command is a sequence of optional variable assignments followed by blank-separated words and redirections, and ...
14
votes
3answers
25k 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?
4
votes
4answers
67 views

How to run a script as if it's running at boot?

I have a script running at boot time, however it's giving me errors I see in the log file. When I run it manually, it runs fine - probably the environment is changed. Is there a way to run such a ...
9
votes
2answers
43k views

How to permanently set environmental variables

My variables are LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib ORACLE_HOME=/usr/lib/oracle/11.2/client64 How to save these variables permanently ?
1
vote
0answers
66 views

export -f in .bashrc after upgrade to bash 4.3.30 kills builtins?

I recently upgraded my bash (Mac OS X 10.6.8) from 3.2.48(1) to 4.3.30(1) via macports, and while the install seems to have gone smoothly, the two spots in my ~/.bashrc where I had export -f myfunc; ...
2
votes
3answers
2k views

How can I keep *all* environment vars for a specific command in sudo?

I have a script that sets several environment variables and then finally calls another script using sudo. The script run with sudo must be able to pick up those variables, and I'm not always going to ...
27
votes
3answers
11k 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: ...
23
votes
8answers
36k views

How can I run a cron command with existing environmental variables?

How can I run a cron command with existing environmental variables? If I am at a shell prompt I can type echo $ORACLE_HOME and get a path. This is one of my environmental variables that gets set in ...
2
votes
1answer
248 views

How to pass environment variables to a non-interactive shell (with example)?

In a sh script another sh script is started with su -l <user> -c /path/to/script.sh. As far as I understood script.sh will be run in a non-interactive shell. The official documentation tries to ...
8
votes
1answer
238 views

Why does bash even parse/run stuff put in the environment variable?

The shellshock bug in bash works by way of environment variables. Honestly I was suprised by the fact that there is such a feature like: "passing on of function definitions via env vars" Therefore ...
8
votes
2answers
162 views

Why is the ability to definine functions in an enviromental variable not a security risk in itself?

As I understand it, generally it is considered safe to let anyone provide information that will be stored in an environmental variable. The shellshock vulnerability is an issue here because it means ...
0
votes
0answers
22 views

Can't set PATH with a script [duplicate]

I have written a script which was supposed to add some value to environmental variable PATH, but script doesn't do that if I start it with ./script.sh. #! /bin/bash INSTALLDIR="/opt/ARM" ...
1
vote
1answer
55 views

How to set `screen` environment variable from bash?

Background I use virtualenv to switch between environments "1.0" and "2.0". I use screen to manage terminals. When I work on one environment I want all new screen windows to start with this ...
2
votes
2answers
143 views

Using gdb to inspect environment variables

I have been trying to find the address of the SHELL environment variable in a program on a Ubuntu 12.04 machine. I have turned off ASLR. I found similar posts : SO question and blog post I have ...
0
votes
0answers
172 views

Runtime parameters for a systemd service

I am a little confused about how runtime parameters are normally supplied to a systemd service. The general idea I have is that the following happens: There is a file that contains the environment ...
7
votes
1answer
371 views

Echo difference between Ubuntu and Red Hat [closed]

I have mostly been experimenting with Ubuntu but recently was using a Red Hat Enterprise system and was surprised at a difference I found setting and displaying environment variables. In Ubuntu I ...
0
votes
1answer
101 views

Trying to access environment variable (array) declared in ~/.profile from shell script

I'm currently fighting with this problem. I've already read some older posts here on SE, and got the conclusion that the only sane way to put a variable (even an array) is ~/.profile. So OK, array ...