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

learn more… | top users | synonyms (1)

1
vote
1answer
30 views

Get value of environment variable in for loop

I have several environment variable pam_branch app_branch worker_branch I use an array to define different projects and I want to get the values of these env var by rebuilding them in a for loop ...
42
votes
4answers
2k views

Is there ever a good reason to run sudo su?

To launch a root shell on machines where the root account is disabled, you can run one of: sudo -i : run an interactive login shell (reads /root/.bashrc and /root/.profile) sudo -s : run a non-login ...
0
votes
1answer
29 views

What is the perfect combination of Environment Variables for Tomcat? [closed]

I hosted one application UI in apache-tomcat server. I had set environment variables in bin/setenv.sh file as: CATALINA_OPTS="-server -Xms256m -Xmx512m -XX:PermSize=512m -XX:MaxPermSize=1024m ...
2
votes
1answer
96 views

Finding out what sh is [duplicate]

I am writing a set of scripts that I want to be portable, but I need to know whether sh on the current platform stands for bash, ksh, or ash. Is there a clear way to do it? What comes to my mind ...
1
vote
1answer
47 views

Why does bash parameter expansion not work inside systemd service files?

I am trying to use systemd's EnvironmentFile and add an option to the command when it is set in the file. I have the following in the unit file: ExecStart=/usr/bin/bash -c "echo ${PORT:+port is ...
0
votes
1answer
64 views

Set Environment variable $PATH globally on Ubuntu 14.04

I am trying to add evironment path variable of composer globally. I've tried many ways but doesnot seem to work. Searched other posts but did not find matching answers. I am trying to work out ...
0
votes
1answer
31 views

When I execute a .run file as <user> it works fine. If I sudo run it, it cannot detect Java

I am trying to execute a .run file that will install some applications. I'm installing the application in /opt/... When I run it without sudo, the installer runs correctly but cannot write to /opt/. ...
1
vote
6answers
91 views

How can I pass an environment variable to a script?

Okay, I can display an environmental variable from the commandline: echo $COLUMNS And get a response. But I can't execute that from within a shell script, I get nothing. So, there must be a way to ...
5
votes
0answers
27 views

Bash: How to avoid variable name substitution when using auto-completion?

I'd like Bash to stop removing variable names from paths and replacing them by their values. I tried several 'shopts' settings in various bash versions but was not successful in keeping a variable ...
2
votes
1answer
60 views

Updating environment variable in a shell script

I am trying to update the value of an environment variable in a third party shell script. My OS is Oracle Linux Server release 6.4 (Red Hat Enterprise Linux Server release 6.4 (Santiago). I already ...
1
vote
1answer
49 views

Configure tmux to use zsh

Right now I have my iTerm session configured to use zsh (/usr/local/bin/zsh), but I'm trying to configure tmux to use zsh as well, instead of /bin/bash/, which it's currently defaulting to. So far ...
3
votes
2answers
359 views

Where do EDITOR, PAGER, BROWSER environment variables come from?

When I look in man bash none of these are defined. However, random posts online refer to them; where do they come from? Or are they just a convention?
0
votes
1answer
11 views

OracleSolaris 11.2 - setting MANPATH variable

What is the right way to extend MANPATH in Solaris? Currently it is empty for a user session, so I get to do it manually in $HOME/.bash_profile: ...
3
votes
3answers
45 views

What's the 'right' format for the HTTP_PROXY environment variable? Caps or no caps?

I've encountered both http_proxy and HTTP_PROXY. Are both forms equivalent? Does one of them take precedence over the other?
1
vote
1answer
29 views

How to switch java environment for specific process?

I use openjdk in my work, but sometimes I need oracle's jre or even specific version of oracle's jre. As I know, I should update JAVA_HOME value and /usr/bin/java or /etc/alternatives/java link ...
0
votes
1answer
31 views

How to change JAVA_HOME temprorary with env command

I use openjdk for my work, but sometimes I need oracle's JRE. I thought that I could use 'env' command for this, but can't figure out why it's not working. I have openjdk in ...
1
vote
1answer
39 views

Magic environment variables in gnome-terminal

I had installed a proxy software (cntlm) on my machine. It sets the environment variable http_proxy to 127.0.0.1:3128. Now I've uninstalled the program using apt-get remove cntlm. However I'm able ...
1
vote
1answer
30 views

How to append to an environment variable using an .env file?

Assuming the .env file is loaded before execution, how can you append to it without overriding it? DEBUG=True FOO=BAR PYTHONPATH="/Users/James/project/" The above file would (?) override it, and ...
0
votes
2answers
34 views

Does kali distro not use /etc/environments file?

I appended a path to /etc/environments file and now it is like so: mindaugas@Kali:~$ cat /etc/environment | tr ":" "\n" PATH="/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /sbin" I ...
1
vote
1answer
43 views

How do I add an installed program to my PATH so I can run it from the command line?

I installed jsx using npm: npm install -g jsx Now it installed jsx in this path: /node_modules/lib/node_modules/jsx/bin In the bin, I'm having jsx. Now if type ./jsx, it works fine as expected. ...
1
vote
4answers
80 views

Is there a CLI tool that would prettify a JSON string [closed]

On my host I enter the following, which returns a bunch of information which isn't particularly easy to read at the CLI. echo $ENV_VAR | base64 --decode Is there a way to format it? This is a ...
2
votes
1answer
27 views

Unset all ENV variables matching _PROXY

I'm trying to unset all environment variables that match _PROXY: env | grep -i _proxy | column -t -s '=' | awk '{ print $1 }' | grep -iv 'no_proxy' | xargs -0 -I variable unset variable but it's ...
3
votes
1answer
116 views

what is the use of “export” command

I created a environment variable in one terminal window and tried to echo it in another terminal window. That displayed nothing. $TEST=hello After that I exported it and tried again to echo it in ...
1
vote
1answer
79 views

HOME is not set when exploiting a vulnerability

Can you help me solve this error? sh: line 61: cd: HOME not set. Distribution: Metasploitable 2 (Ubuntu 8.04) /root/.bashrc (comments and whitespace removed): [ -z "$PS1" ] && return ...
3
votes
3answers
128 views

How to set HOSTNAME in zsh?

In bash, which sets $HOSTNAME for you, I was able to calculate the total length of prompt line simply by using something like: PS1_length=$((${#USER}+${#HOSTNAME}+${#PWDNAME}+12+${#PS1_GIT})) It was ...
0
votes
0answers
17 views

Can I run a single program without running it through a window manager? (Gnome, Technic-Launcher)

I'm running into an issue with Technic-Launcher being completely white when run in gnome, but it's fine in other DE's. The developer says it's an issue with mutter and undecorated java windows. Can I ...
1
vote
1answer
23 views

How to correctly set the XDG base dirs gobally and dynamically

I get a lot of config folders in my homefolder. I assume that is, because $XDG_CONFIG_HOME is not set and some software (e.g. fontconfig, umlet) does not follow the standards. $XDG_CONFIG_HOME ...
2
votes
2answers
130 views

Zsh: export: not valid in this context

When running this script, I run into an error on this line (relevant snippet below): ... _NEW_PATH=$("$_THIS_DIR/conda" ..activate "$@") if (( $? == 0 )); then export PATH=$_NEW_PATH # If ...
15
votes
3answers
801 views

Issue an error when using empty shell variables

Sometimes I use, $PROJECT_HOME/* to delete all files in the project. When the environment variable, PROJECT_HOME is not set (because I did su and the new user doesn't have this environment variable ...
1
vote
0answers
27 views

If processes can't modify their parent's environment, what is MC doing?

As far as I know, a process cannot modify its parent's environment. However, when I run mc (GNU's Midnight Commander, a curses-based file manager) and then quit it, I end up with another $PWD: ...
0
votes
1answer
72 views

Fixing a broken PYTHONPATH environment variable

I recently installed some software, which required python to operate. For some reason, it installed its own version of python, and modified the PYTHONPATH variable. Now, when I attempt to import a ...
0
votes
0answers
30 views

Computer won't load if I comment out sourcing bashrc from .profile? [duplicate]

I am trying to understand the difference/application of system files like .profile/.bash_profile/.bashrc etc. Now, I understand that .profile will be sourced when I login to the computer routinely ...
0
votes
0answers
72 views

$PATH variable on Fish Shell OS X

I have somehow screwed up my path variables with Fish shell on OS X. Is this the proper $PATH variable in the config.fish? user@host ~> more ~/.config/fish/config.fish set -g -x PATH ...
5
votes
2answers
286 views

Can you execute a Bash function with the `at` command?

I want to execute a Bash function at a scheduled time. I think the right tool for this is the at command. However, it doesn't seem to be working. function stupid () { date } export -f stupid ...
3
votes
2answers
94 views

What is the difference if I start bash with “/bin/bash” or “/usr/bin/env bash”? [duplicate]

In shell scripts one specifies language interpreter on shebang(#!) line. As far as I know, it is recommended to use #!/usr/bin/env bash because env is always located in /usr/bin directory while ...
2
votes
1answer
79 views

How to safely transmit a password over SSH for a remote command to use

On the local server, I have a program that stores the password in the predefined environment variable (SPECIAL_PASSWORD). On the remote server I have a program that reads and uses a password from a ...
4
votes
1answer
56 views

Settings environment variables from a file

I want to have a file (outside of git) that contains certain environment variables. While a script (which is in git) needs to read them and export to env. My current implementation works for ...
0
votes
2answers
107 views

export PATH permanently [duplicate]

I have exported the PATH but once I switch to a different terminal or reboot Debian, $PATH is reset. Here are the steps I take: ~$ vim scripts.sh #!/bin/bash echo "Hello" I save it as mybash.sh ...
4
votes
0answers
66 views

Is it possible to make an exec call that “returns”?

Is there a way to make the exec system call work like a function call that returns instead of totally replacing the current process image? My motivation is trying to integrate two shells with ...
2
votes
1answer
141 views

Why sudo env is not showing all the environment variables?

I have a variable set in a script file in /etc/profile.d/somescript.sh I have modified the /etc/sudoers and added "ansible" user to the sudoers file like this: Defaults !env_reset ansible ...
1
vote
2answers
654 views

How to set Ruby GEM_HOME and GEM_PATH

I'm a NOVICE user of Linux and using Linux mint 17.1 I've reinstalled Linux mint 20 time in last 3 days for that issue but could not fix it I'm trying to install ruby on rails using rvm what ...
2
votes
1answer
131 views

How do I run GUI applications as root by using pkexec?

I am using Trisquel GNU/Linux-Libre which comes with Gnome3 Flashback Desktop Environment. I know that I can run GUI application as root by sudo & gksudo but I want to know that How do I run GUI ...
-1
votes
1answer
70 views

How can I execute and export in a single shellscript

I have two shell scripts. $ cat java_alternative_7 #!/bin/sh sudo update-java-alternatives -s java-7-oracle $ cat java_home_7 #!/bin/sh export JAVA_HOME=/usr/lib/jvm/java-7-oracle It's simple that ...
0
votes
0answers
9 views

Pip managed python extending distribution packaged modules

I am looking for recommendations on extending the python library managed by my arbitrary distribution with packages available via PPI. Basically I have been working with a distro managed installation ...
1
vote
1answer
93 views

When not started from a terminal, Emacs does NOT pick up the SSH_AUTH_SOCK environment variable

When I don't start it from a terminal, Emacs 24.5.1 (compiled from source) doesn't pick up my environment variables. In particular, to "import" the environment variables from shell, I have in my ...
2
votes
2answers
321 views

how to pass environment variable to sudo su

I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesnt work. How can I pass the env variable $DUMMY to su? -p doesnt work with -l.
1
vote
3answers
95 views

Differences between sudo and su in inheriting environment

Why can the command run by sudo inherit the environment from the parent shell process, while the shell process after sudo su to the root user doesn't? t@ocean:/tmp$ export ME=tim t@ocean:/tmp$ sudo ...
1
vote
2answers
66 views

Identify user defined variables

In a GNU/Linux bash shell, I am using a command to identify and save all my user defined variables at a specific point in time for debugging purposes (I source the file later): declare | grep ...
0
votes
3answers
83 views

Pass environment variables' values to a program? [duplicate]

When I run a perl script pdfannotextractor.pl in bash, I want to set the value of a variable TEXMFVAR needed by the script, and pass it to the script. I googled around, and thought I found a ...
0
votes
1answer
55 views

csh: Terminal inherits environment variables from an unknown location

I'm on a shared machine running CentOS 5.10 that I log onto using VNC from Windows 7. Our default and official shell is csh. Every time I open a new terminal, I have three particular environment ...