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

learn more… | top users | synonyms (1)

3
votes
1answer
36 views

How to temporarily change locale for sudo?

To change the locale of the current user like export LANG=en_US.UTF-8. But this environment variable doesn't affect the root user. When I use sudo the display language remains default. How can I ...
1
vote
2answers
48 views

What sets the $SHELL environment variable?

Where is the environment variable $SHELL first set on a UNIX system? How can I find and print all of this type of default settings of my terminal?
1
vote
1answer
42 views

Where are the places the PROMPT_COMMAND variable could be set?

I installed drush and as part of the installation it makes some changes to the PROMPT ... # Optional. Enrich the bash startup file with completion and aliases. drush init ... Whenever I execute an ...
2
votes
1answer
36 views

Exporting a variable so it appears in a script sourced through sudo

I have a bash script/s which has a "main" script which is run as sudo. Variables are declared in this script. Then it sources another commands.sh script, however this script uses sudo to drop back to ...
1
vote
1answer
36 views

Pass Environment Variable to Sudo AWS ec2 sudo node

I am new to linux and AWS. I have a node.js server running on an EC2 instance. I am running the following command to keep it running endlessly and on port 80: $ sudo node app.js & Now when I ...
0
votes
2answers
100 views

How to properly set environment variables in Debian Jessie?

I can't figure out how to set environment variables properly, even though I tried to follow https://wiki.debian.org/EnvironmentVariables. I've added this to ~/.bashrc: if [ -f ~/.bash_profile ]; ...
3
votes
1answer
71 views

Can't export environment variables on X session start

My setup is: Debian testing (stretch), up to date LightDM with autologin enabled Awesome window manager bash, in ROXTerm or XTerm I don't seem to be able to set own environment variables and get ...
0
votes
1answer
48 views

“export VAR=thing && someCommand” reports “export: `&&': not a valid identifier”

I'm trying to set an environment variable and execute a command in a single line, like this: export PUB_CACHE=/app/src/.pub-cache && dart-sdk/bin/dart server.dart (Don't ask why... it's ...
0
votes
2answers
54 views

Get the latest value of an environment variable is a bash shell script

I wonder how can we get the latest value of an environment variable in a bash shell script. Problem I am having is, I have a environment variable which can be changed externally multiple times. But ...
0
votes
0answers
22 views

How to make cron job which suspends computer before specified time of the day

I am trying to make script which suspends computer if it is used before specified time of the day or if it is used too long. #! /bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/...
0
votes
2answers
13 views

How can i get an overview about env (environment variables) of all users on a system?

How can i get an overview about env (environment) of all users on a system? Status: i've got over 600 user in passwd, but each of them could have a env variable for a specifec project path (~10 ...
0
votes
2answers
67 views

Systemd bash builtins

I have an application that needs to use the commando source for setting his environment file. [Unit] Description=Programname After=syslog.target network.target [Service] User=root ExecStartPre=...
0
votes
0answers
49 views

Environment Modules: installing software

I understand how Environment Modules work, having used them before. I have read the various help pages, and I understand how to write a module file. My question is explicitly about the various ...
0
votes
1answer
40 views

Using export USER=myName doesn't change the output of whoami

I saw this example $ whoami MatsP $ g++ -Wall -std=c++0x getenv.cpp $ ./a.out MatsP $ export USER=DonaldDuck $ ./a.out DonaldDuck but for me it doesn't work. I am in a Debian machine. I used ...
1
vote
2answers
162 views

An environment variable with equal sign and && operator

I want to create an environment variable for this command: git --git-dir= echo test-folder/.git/ add Steps-to-follow.txt && git --git-dir= echo test-folder/.git/ commit This is a relevant ...
1
vote
1answer
44 views

how to get or reflect the name of the bash function which is called? [duplicate]

i did not yet found a solution to this. Anyone a hint? i sometimes write bash functions in my shell scripts and i love to have my scripts being verbose, not just for debugging. so sometimes i would ...
0
votes
1answer
42 views

Substitute variable in value of chpst loaded environment variable

If I use chpst to load environment variables like: env BAR=baz chpst -e envdir mycommand and in envdir I have a file envdir/FOO with contents foo$BAR is there a way so that for mycommand the ...
2
votes
2answers
73 views

Updating shell functions and aliases through environment variables

Say we define the following shell function and alias in .zshenv: export VARIABLE_A='original' function my_function() { print $VARIABLE_A } export VARIABLE_B='original' alias my_alias="print $...
0
votes
1answer
78 views

How to set multiple env variables from stdout pipe

I have a bunch of piped shell commands that give some env output. I want to set these as env variables for an additional command to add to the chain Kevins-MBP:ops kevzettler$ eb printenv | tail -n +...
1
vote
1answer
33 views

Which shells have functions where “local” does not alter exported variables for child processes?

In the example below, an exported variable is re-set as local in a function. Bash, Zsh, Fish don't pass on the original value to the child process. Are there any shells that make local affect the ...
2
votes
3answers
140 views

Bash one-liner to temporarily append path for chained commands without additional bash invocation?

Consider this: $ cd /tmp $ echo "echo YES" >> prog/myprog $ chmod +x prog/myprog $ prog/myprog YES $ myprog myprog: command not found I can temporarily modify PATH to call myprog by name like ...
0
votes
1answer
61 views

.zshenv not sourced on ssh login?

According to the docs .zshenv is sourced on all invocations of the shell, unless the -f option is set. It should contain commands to set the command search path, plus other important environment ...
1
vote
2answers
83 views

Why some commands don't load user environment when executed with ssh? (while other do)

On a target machine (OS X El Capitan) I have brew in /usr/local/bin. When I try to get brew's path I get no result: # ssh vagrant@127.0.0.1 -p 2222 which brew # Troubleshooting: brew is in /usr/...
1
vote
1answer
27 views

How can I set kerberos principal in environment automatically on the remote host?

I use both legacy krsh and ssh to login to a variety of boxes for root administration, as do several colleagues of mine. We all keep different history files by use of a variable calculated by running ...
1
vote
1answer
89 views

What is the LESS environment variable to man and how is it set up?

What is the LESS environment variable used for in man? I found that it could make the output of man jump to a match to the pattern stored in LESS. What about when there are several matches? How is ...
3
votes
1answer
81 views

how to: Please sudo, do _not_ setup any environment, especially $SUDO_USER?

I want to start a process as another uid and it should not need any information from $(env), so I strip the environment prior to the sudo -u powerlessuser /bin/processCmd, that is I run this env -i ...
3
votes
1answer
122 views

Difference between logname and $LOGNAME

While reading about environment variables, the one I came across was LOGNAME, I'd like to know the difference between this variable and whatever the command logname returns - as both of them did ...
2
votes
3answers
116 views

Trying to understand .bashrc, env, and export

Disclaimer: Using bash. I just need some confirmation / correction on my understanding of these things: env is basically displaying the current environmental variables that are accessible to my ...
0
votes
1answer
31 views

Make exported path effective immediately?

I'm using a script to export a path like this: echo "export MONO_PATH=~/turbo/" >> ~/.profile; So from now on, the path will be available whenever the user logs in. However, I want to the ...
2
votes
1answer
189 views

Set environment variable (TZ) for all startup scripts and inittab

I'm working on an embedded Linux system and looking for a way to set the time zone for all processes. The question is: Is there any possibility to set the TZ environment variable at boot time (init ...
2
votes
2answers
64 views

How to store the printout of the last command in a shell variable in urxvt/zsh?

I'd like to have the printout (stdout and stderr) of the last command run within zsh available in a variable ready to use grep, etc on it.
0
votes
1answer
22 views

Conditionally command line export variable

If I run export COMMAND=nonexistentcommand && which $COMMAND >/dev/null || \ (echo "download filewithcommand.sh" && export COMMAND=./filewithcommand.sh) echo "command: $COMMAND" ...
2
votes
2answers
30 views

Why some scripts use export for system variables? [duplicate]

I see many online tutorials for ubuntu, and some of them are using export= in the beginning of the script for system variables. for example: export JAVA_HOME=/usr/local/java/jdk1.8.0_05 export ...
5
votes
3answers
135 views

bash script's temporary value on command

Like below command, if true; then IFS=":" read a b c d e f <<< "$test" The book says when value assignment command (IFS ":") is used before main command(read a b c d e f <<< "$...
0
votes
1answer
87 views

env -i and bash-c

Can someone please help me understand the difference between bash -c 'echo $SHELL $HOME $USER' and env -i bash -c 'echo $SHELL $HOME $USER' I tried going over it many times but I still don't get ...
3
votes
1answer
186 views

Bash script can't locate perl module

I have a shell script which isn't running menutray on i3 startup. Line in .i3/config: exec ~/.i3/i3-scripts/menutray.sh This is what I tried for debugging: #!/bin/bash menutray -i -u -r &>/...
1
vote
0answers
38 views

automating variables [closed]

I would like to automate variables in a script that contains access to a library. The library has certain outputs that I want to compare. The following is an example of the variables that I want to ...
1
vote
1answer
95 views

CentOs 7 CronTab set JAVA_HOME

With the root user I configured the JAVA_HOME variable for crontab like this: [root@localhost ~]# vim /etc/crontab _______ SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/jdk1.8.0_71/bin ...
6
votes
1answer
250 views

Setting a IFS for a bash script

The typical case is IFS= read. The subject is very well explained in this thread: why is setting a variable before a command legal in bash? In order to have a complete picture, I'd be very grateful if ...
0
votes
1answer
37 views

how can we change the DISPLAY variable in linux [closed]

What is the command to change the DISPLAY display variable in Linux, because while installation of a program I am getting the error as in the attached screen shot, so please help me how to get it out ...
2
votes
1answer
38 views

How to set environment variables on server/client?

On some workstations (Debian & Ubuntu) and on a server (CentOS) I need environment variables for some scripts and jobs. What I did was altering ~/.profile: SOMEVARIABLE=/some/custom/path ... Is ...
1
vote
1answer
40 views

How to assign a variable within a pipe

I'm building a one liner in bash. If making a script or writing temp files were an option, I wouldn't need to ask. I need to assign a variable in the middle of a set of pipes to use down the line. ...
2
votes
1answer
39 views

The environment given to a program vs the execution environment in which the program is invoked

Bash manual says When a program is invoked it is given an array of strings called the environment. This is a list of name-value pairs, of the form name=value. What are the relation and ...
0
votes
2answers
48 views

Which location does shell assign normal variable?

As you know, bash shell itself is also process. If I use command export a=c, then shell dynamically allocates variable a into location where environment variables are reside.(This environment section ...
2
votes
0answers
95 views

Setting the LANG environment variable for xfce

I am on a multi user Debian Stretch system which has en_US.UTF-8 as default locale, but I want de_DE.UTF-8 for my user. I was able to set it for terminals, by adding export LANG=de_DE.UTF-8 to ~/....
0
votes
2answers
63 views

Correct way to set PERMANENT environment variables from script

I want to do a very simple install process for my app framework. I've got everything working, but I want to set two environment variables. I want to update the PATH and also set a HOME variable. I ...
0
votes
0answers
46 views

Run VNC at startup as root - HOME variable not being set

I have the following code in /etc/init/vnc.conf (used by Ubuntu 14.04's Upstart): description "VNC on start" author "user129013" start on runlevel [2345] exec /root/vnc The job is running ...
0
votes
2answers
155 views

bash command to print gcc environment variables

Is there a way to print all the GCC environment variables(path for include directory, library) from the command line, i.e something similar to 'printenv' that gives all bash environment variables ?
2
votes
2answers
65 views

Why does .pam_environment not include $HOME in my new path?

I created a /home/myname/.pam_environment file containing PATH DEFAULT=${PATH}:${HOME}/apps/flyway But my new path doesn't end with /home/myname/apps/flyway. Why not? $ echo $PATH /usr/local/sbin:/...
0
votes
2answers
39 views

$USER environment variable not changed to root

The USER env variable is unchanged after gaining root access. [user1@comp]$ echo $USER user1 Logged in the system as 'user1'. Now check the output after gaining root access. [user1@comp]$ su ...