A set of dynamic variables that can affect the running processes.
1
vote
1answer
57 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 ...
4
votes
4answers
51 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 ...
1
vote
0answers
31 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
1answer
70 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 ...
6
votes
1answer
172 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
141 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 ...
-1
votes
0answers
31 views
Latest Bash shell hack [duplicate]
What is all this recent fuss about Bash being vulnerable? I read that it is somehow related to environment variables but could not get a hold of it.
Can someone explain this vulnerability to me?
0
votes
0answers
21 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"
...
0
votes
0answers
16 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
1answer
28 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 ...
1
vote
1answer
42 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 ...
2
votes
2answers
76 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
39 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 ...
0
votes
0answers
11 views
Passing environment variable to PHP on the command-line [migrated]
On CentOS, I'm trying to pass an environment variable to a PHP script.
I've created this file, test.php:
<?php print_r($_ENV);
When I run this command:
DB=mysql php test.php
I get the ...
0
votes
1answer
52 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 ...
1
vote
0answers
28 views
Setting XDG_DATA_HOME and XDG_CONFIG_HOME on compile/per program
The goal is to have a -dev version and a stable repository-based version installed at the same time, but with different data and config directories so that the dev version is not operating on(and ...
2
votes
0answers
110 views
Locale environment variable settings do not take effect
I have a Debian 6 (64-bit) VPS where I cannot seem to get the locale environment variables LANG and LC_* set. (Everything below as root).
vps:~# locale -a
C
POSIX
en_US.utf8
nl_NL.utf8
vps:~# locale
...
9
votes
1answer
215 views
Why does the location of Enviroment Variables vary that much?
Reading the book Hacking: The Art of Exploitation by Jon Erickson, I am trying to approximate the address of an environment variable SHELLCODE to exploit a program.
Every time I run ...
2
votes
1answer
64 views
Which file defines the LESSOPEN environment variable?
please advise me about the following. On my Linux machine - I do the following:
$ env | grep -i LESSOPEN
LESSOPEN=|/usr/bin/lesspipe.sh %s
So from env command I see that:
...
2
votes
2answers
91 views
How to find where is $JAVA_HOME set? [duplicate]
I'm a beginner with linux. I'm trying to change the value of $JAVA_HOME & I just can't seem to find in which file is it being set currently. I can't remember where did I set it the last time. ...
1
vote
1answer
48 views
Choice of editor when running under sudo
On an Ubuntu 12.04 machine I've used the alternatives system to set the editor to vim.basic. I get the correct editor when root but not when I sudo to root and run crontab, and I'm trying to ...
1
vote
1answer
31 views
Global variable for every script
I want to declare a variable in such way that every script can access and alter its value.
I have written a script that set the value of a variable called flag on exit and I am using a crontab entry ...
1
vote
4answers
165 views
why do we not need export here?
$ IFS=";"
$ read first second
i am;a_i b c
$ echo $first
i am
$ echo $second
a_i b c
$ echo $IFS
Am I right that read first second is a subprocess of the current
shell process? If yes, why don't ...
6
votes
2answers
133 views
Are environment variables visible to unprivileged users on Linux?
I'm trying to determine if, in Linux, environment variables for a process are observable by other (non-root) users.
The immediate use case is putting secrets into environment variables. This is ...
1
vote
2answers
52 views
profile.d on headless server
Is it a bad idea to put variables needed by a daemon program running at boot on a headless system in /etc/profile.d/? From my understanding profile.d doesn't get executed until someone logs into the ...
6
votes
1answer
215 views
Echo difference between Ubuntu and Red Hat
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 ...
1
vote
1answer
79 views
Where can I set global Java Options?
I have horrible, improperly-rendered fonts in Java programs such as jabref and rubymine. This can be fixed by running
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on' jabref
I understand that I ...
0
votes
1answer
56 views
How set glib environment variable: g_slice
I've been told I need to set the following environment variable in order to work around a glib bug:
G_SLICE=always-malloc
But I don't know how to do it, and anywhere I've seen it's use recommended, ...
2
votes
2answers
179 views
How is PATH set for users in puppet?
I'm having an interesting problem which I was able to work around by manually specifying PATH.
The problem is that although my root user's PATH is:
...
1
vote
0answers
302 views
Inherit environment variables in systemd Docker container
I have a Docker container running systemd. I want to pass environment variables to applications under it.
When I start systemd from within Docker (/sbin/init as command line), Docker exposes ...
20
votes
2answers
854 views
Does ~ always equal $HOME
I know this has probably been asked before, but I couldn't find it with Google.
Given
Linux Kernel
No configurations that change $HOME
bash
Will ~ == $HOME be true?
5
votes
3answers
211 views
Run program with environment set to variables in a file
I would like to run a program (in this case Python) with only the environment variables defined in a file, say vars.env:
FOO=bar
X=12
Here's a simply Python script that prints the environment:
...
4
votes
1answer
169 views
Keep getting the same result after “export PATH”
I am doing this:
$ which cabal
/usr/bin/cabal
$ export PATH=$PATH:$HOME/.cabal/bin
$ which cabal
/usr/bin/cabal
I expect to get /.cabal/bin/cabal for $ which cabal (this path exists) after this. ...
2
votes
1answer
68 views
How can I find where LANG, LANGUAGE and MAIL environmental variables are set?
I've had a few issues with environmental variables not set correctly in my Raspbmc Raspberry Pi. Specifically, I've had to manually specify the following in ~/.bashrc.
export LANG='en_AU.UTF-8"
...
2
votes
0answers
203 views
Reading from /etc/environment with sudo
Using Ubuntu 14.04 LTS, I'm having a problem trying to read environment variables from /etc/environment when using sudo env. Basically, they are not being displayed. When I do just env, these ...
14
votes
3answers
554 views
Using variables to store terminal color codes for PS1?
In my .bashrc, I use ANSI terminal color codes to colorize various bits. It looks like this:
PS1='\u@\h:\w\[\033[33m\]$(virtual_env)\[\033[32m\]$(git_branch)\[\033[0m\]$ '
where virtual_env and ...
15
votes
2answers
457 views
How do I start all shell sessions in a directory other than $HOME?
When I open my non-login shell in Ubuntu, my present working directory is /home/user_name (my $HOME environment variable), but I want to change this such that when I start my terminal I am in some ...
0
votes
2answers
63 views
Why do I have to execute bash programs with ./? [duplicate]
Why is it that some bash programs will only run on my system when I type ./ before their name?
An example: In my [...]/android/sdk folders I have to execute adb like this:
./adb devices
Why not ...
3
votes
3answers
421 views
Messed up bash.bashrc file, commands not working anymore
Trying installing Java, I tried to add it to the executable path with the line:
export PATH=/usr/lib/jvm/jdk1.7.0_60/bin:$PATH
in the system-wide /etc/bash.bashrc file.
For some reason this ...
2
votes
1answer
338 views
Bash script for running python virtual environment does not execute
I am trying to wrap the following call into a script, which runs my Python virtual environment:
[lucas@lucas-ThinkPad-W520]/home/lucas/bin$ source ...
1
vote
0answers
27 views
Programmatically obtain LILYPOND_DATADIR for execlp() call
I wrote an application that calls lilypond by execlp()ing it. However, when my app executes this line, the following error occurs:
GNU LilyPond 2.16.2
warning: not relocating, no 2.16.2/ or current/ ...
8
votes
4answers
176 views
Save output of command that modifies environment into a variable
How to save output of a command that modifies environment into a variable?
I'm using bash shell.
Assume that I have:
function f () { a=3; b=4 ; echo "`date`: $a $b"; }
And now, I can use commands ...
1
vote
1answer
55 views
Multiple MODULEPATH entries in .modulesbeginenv
I'm switching between paths/code projects. At each place I have different modules. To handle this there is a setup script that modifies what to use. This is handled with the tool 'module'.
NOTE: ...
0
votes
0answers
31 views
Parameters files, pfiles director: how to overwrite default settings
This is a quite general question that I am not sure to be able to address correctly.
I must manage some bash or tcsh scripts that invoke other software's tools.
These tools are invoked by name and ...
4
votes
1answer
545 views
how to set environment variables from a shell script? [duplicate]
I'm trying to set environment variable through a shell script. Here is the script with various techniques:
#!/bin/sh
echo "export SOMEPATH=/root/some" >> /root/.bash_profile
echo "export ...
6
votes
2answers
237 views
if statement in .bashrc not working correctly
I set up .bashrc to show a long prompt if the terminal is at least 80 characters wide. Otherwise it shows a degraded, smaller prompt.
I use an if statement to achieve this:
dp_smaller_than=80
if [ ...
2
votes
1answer
49 views
What does the period indicate when an environmental variable is set like “VARIABLE_NAME=.”
What does the period indicate when an environmental variable is set like VARIABLE_NAME=.
5
votes
3answers
326 views
Is there any harm in using variables that aren't set?
Say I have the following code:
# Check if the color prompt is enabled and supported on this system
if [ -n "$force_color_prompt" ] && [ -x /usr/bin/tput ] && tput setaf 1 ...
1
vote
2answers
110 views
How to guarantee availability of $BASH_ENV
A non-interactive, non-login shell will try to source any script specified in $BASH_ENV. But how do I guarantee $BASH_ENV is set before a cron job or script has a chance to set $BASH_ENV for any ...
1
vote
2answers
359 views
Setting PATH vs. exporting PATH in ~/.bash_profile [duplicate]
What's the difference and which is better to use when customizing my bash profile? Documentation on the export command is scarce, as it's a builtin cmd.
Excerpt from version 1 of my ~/.bash_profile:
...