New answers tagged

0 votes

Open new terminal with environment specified by source command

You just source first and open the terminal after (I am using the portable . instead of the bash-specific source): . source_somefile && xfce4-terminal The terminal will inherit the ...
  • 221k
2 votes
Accepted

Unsetting an exported environment variable

unset OPCON_VERBOS or OPCON_VERBOS= or OPCON_VERBOS="" The unset removes the environment variable (and its value). The others keep the environment variable, but set its value to the ...
  • 1,725
0 votes
Accepted

Environment variable and function argument

Functions are not subshells. Any changes you make to variables in the function will propagate unless you append them with local You can make a function a subshell by wrapping it in parenthesis () In ...
  • 484
0 votes

User defined environment variables

If I'm understanding your question correctly, you want a given user---if they desire it---to be able to activate the verbose option, e.g., mv -v---on certain commands. If this is correct, I have two ...
  • 218
1 vote
Accepted

User defined environment variables

To set a variable, all you need to do is set it. For example, say you have a shell function that changes its behavior depending on whether a variable is set, like this: check_verbosity(){ if [ -n ...
  • 221k
1 vote

How safe is it to use EXPORT in bash scripts when using GNU Parallel?

Environments variables are passed into the child processes, not the other way. If you want to transmit information to the parent process, then you want to put this data into one file per child and cat ...
  • 1,162
13 votes
Accepted

Is PS1 really an environment variable?

The PS1 variable, as well as a few other variables that affect the shell (see the section called Shell Variables in the bash manual), are not exported and are, therefore, not environment variables. ...
  • 282k
1 vote

Using `env` command with `eval`

Why do you even want eval? Just use the shell: $ cat foo.sh #!/bin/sh env -i SOMEVAR=SOMEVALUE sh -c "$@" Then you run it like this: $ foo.sh 'echo $SOMEVAR' SOMEVALUE
  • 221k
0 votes

How to change /proc/*/environ of a bash shell

Another examples,you can use strings show proc/$$/environ file. strings /proc/$$/environ # $$ mean current process PID, # strings process newline characters in file. ...
1 vote

set or pass an environment variable to a snap application (reach pulseaudio server on another machine via tcp from within a snap application)

This is a bit of a hack, but here is how you can pass an env variable to a snap, using chromium as an example: echo "PULSE_SERVER=$PULSE_SERVER; chromium.launcher" | snap run --shell ...
  • 11

Top 50 recent answers are included