Tag Info

New answers tagged

3

A long, long time ago: This document details the changes between this version, bash-2.05a-rc1, and the previous version, bash-2.05a-beta1. Changes to Bash … w. Bash no longer auto-exports HOME, PATH, SHELL, or TERM, even though it gives them default values if they don't appear in the initial environment. I don't know what ...


1

As the sudoers settings vary between OSes it is hard to predict what would work for you. sudo -EH the H switch tries to set $HOME to the target user's value, but this would not preserve $ZDOTDIR. Or add the line below to the end of sudoers using visudo. This tells sudo to keep the variables listed from the current environment. In this case you would then ...


1

No, X doesn't mangle environment variables. But bash does; specifically, it unsets PS1 and PS2 in non-interactive shells: $ PS1='my PS1' PS2='my PS2' PS3='my PS3' PS4='my PS4' bash -c export |grep PS declare -x PS3="my PS3" declare -x PS4="my PS4" Bash is probably executed somewhere as part of your login sequence. That's guaranteed if your /bin/sh is bash ...


-1

I'm going to assume you're running bash as your shell. If you're running something else the specifics will vary but the approach will remain much the same. To confirm your login shell, run this command: getent passwd "${USER:-$(id -nu)}" | awk -F: '{print $NF}' I suspect that your prompt is defined in .profile or .bash_profile and is set (once) when you log ...


2

The usual way is to create a script which calls the binary as part of the script. Then you can just set the variables in the script. In fact, it is not uncommon for executables corresponding to complex programs to be set up like that. E.g. chromium. So, if /usr/bin/thunderbird isn't already a script (check) you can create a script called /usr/bin/thunderbird ...


0

After going through man bash got the whole picture. If I had read man before posting the question! BTW above one answer doesn't seem correct while other one falls short to clarify. So: The shell has an execution environment, which consists of open files inherited by shell at invocation, the file creation mode mask, shell parameters inherited from the ...


1

Under the hood, the way environment variables transit from program to program is through the execve system call, which loads a new program image from disk. (This image replaces the current program; there's another system call, fork, which duplicates the current program; functions like system combine fork, execve and a few other system calls to launch a ...


1

The shell builtin set shows all variables, not just those that have been exported to the environment. If you want to add a variable to the environment, simply do export variablename in your shell.


1

Awesome example above. I tried something much simpler (albeit a little more attractive) on FreeBSD 10.1. I needed to install top 3.8 from source. The following works fomr csh/tcsh setenv TOPCOLORS ...


1

gmrun inherits the $PATH variable set by the parent that spawned it. Hence, you can make it source ~/.bashrc by initiating it with: bash -ci 'gmrun' This creates an "interactive" shell; this has a few differences to a non-interactive shell, but works perfectly fine with gmrun. Simply bind the command above to your hotkey.


1

I can't speak for other distributions, but Ubuntu has a file, /etc/environment, that is the default search path for all users. Since my computer is only used by me, I put any directories that I want in my path there, unless it is a temporary addition that I put in a script.



Top 50 recent answers are included