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

learn more… | top users | synonyms (1)

2
votes
1answer
70 views

Can't vi in single user mode

Forgive my ignorance, but I have the following problem: In DragonflyBSD, I need to edit /etc/rc.conf in single user mode, but # mount -u / # mount -a # vi /etc/rc.conf vi: unknown: unknown ...
1
vote
1answer
216 views

bash set variable with colon (:) and dash (-) in it (as used by lftp)

so lftp uses some weird shell variables, like the following: xfer:log-file = 1 sftp:connect-program = “ssh -a -x -i keyfile” how would I set these variables? I've tried using set, and env; as well ...
1
vote
2answers
135 views

Arrays in Zsh. Check if any of the following variables is not defined

Say we have a set of variables that we want to test if they are defined, and set a condition if any of them are not. I am thinking of proceeding with something like the following: #!/usr/bin/env zsh ...
2
votes
1answer
126 views

Preserve OLDPWD after logging out

I often need to go to the directory I was when I logged out of a server. I habitually use cd - for this purpose. However, after logging out and logging back in this does not work because apparently ...
1
vote
1answer
262 views

How to pass environment variables to a new ssh-initiated login session?

Suppose that some variable FOO is defined (and export-ed) in the current environment. Let me call this environment E0. Now, I log into some other Unix system using ssh. % ssh ...
0
votes
0answers
226 views

JAVA_HOME set to /usr/lib/jvm/jdk1.8.0_60, yet when running java it does not work?

I needed to set JAVA_HOME and DATABASE_HOME to install Adempiere, so I did it by editing .bashrc as shown here, and then restarting virtual machine. [Linux version is Ubuntu 14.04.3]. When I run ...
0
votes
1answer
125 views

Makefile include env file

I'm trying to include some env vars into a Makefile. The env file looks like: FOO=bar BAZ=quux Note there's no leading export to each env var. If I add the leading export and just include the env ...
3
votes
2answers
78 views

Get environment variables of running session

Yes, I know that this question is a bit confusing, I just mean "the variables which are acessible from session's command line". I am writing an application which runs automatically by upstart on ...
0
votes
1answer
31 views

Restrict unix user from setting environment variables during the active session

I've a condition in which I want to restrict a unix user from setting up environment variables or modifying the environment variables locally during the user's active unix session. For example, if ...
1
vote
2answers
102 views

How can I use the environment variables inside a regular expression in awk?

#!/bin/sh ALTER="1153" NAME="aio" for i in $(ps -eo pid,etime,comm | \ awk -v alt="$ALTER" -v name="$NAME" '$2~/[^0-alt]-/ && $3~/name/{print$1} '); do echo $i done
7
votes
2answers
260 views

How to prevent the caller's shell from being used in sudo

I'm running sudo-1.8.6 on CentOS 6.5. My question is very simple: How do I prevent SHELL from propagating from a user's environment to a sudo environment? Usually people are going the other way- they ...
3
votes
1answer
80 views

Export a selection of environment variables with correct escaping

I want to export some environment variables which I set in a dash script to a file: myvariable="line 1 LINE=3 some characters: # \" \$ line 5" myvariable2="abc" export myvariable myvariable2 ...
0
votes
1answer
86 views

How to import self made modules in Python on Ubuntu 15.04

I just moved from windows 8 to Ubuntu 15.04. I do some programming in python3, and some programs rely on imports from self made modules. In windows all I had to do was add the directory which contains ...
4
votes
2answers
206 views

Why do `env var=value` allow arbitrary name in var?

Reading env POSIX documentation: Some have suggested that env is redundant since the same effect is achieved by: name=value ... utility [ argument ... ] The example is equivalent to ...
-2
votes
1answer
71 views

How to solve the defining variables in bash prompt command not found the problem

My Linux distributions centeros7, define variables on the bash prompt command not found [wanghao@localhost ~]$ al = nihao bash: al: command not found... [wanghao@localhost ~]$
5
votes
2answers
133 views

Using ~ in symlink target or making a symlink with a variable

I would like to create a symlink to ~/foo/ but when I write that, ~ is always resolved to the absolute home path. I've used ../s in the past and they work fine, is ~ not allowed? The reason I'd like ...
0
votes
1answer
39 views

environment file variable equals another variable [closed]

Is there a way to create an .env file that defines a variable with the value of another variable? I have tried using: var1=$var2 And it obviously doesn't work. Any takes?
1
vote
2answers
82 views

Cannot run command inside bash variable including square brackets with nullglob

Assuming I want to run commnand stored inside the variable with nullglob turned on. For example: shopt -s nullglob a="echo [foo]bar" ${a} This gives me an empty output due to the nullglob option of ...
1
vote
1answer
63 views

Indirectly expand variables in shell

I need to indirectly reference a variable in the bash shell. I basically want to what you can do in make by writing $($(var)). I have tried using ${$var} which would be the most straight forward ...
1
vote
2answers
69 views

use an export variable as part of filename in awk program

I have set an export X25DATAF=/home/Bob/X25/Datafiles in my profile and that's what is outputted when I do a echo $X25DATAF. I want to replace /home/Bob/X25/Datafiles in the awk below with the ...
0
votes
3answers
61 views

how to add these 3 lines as enviroment variables to .profile bash file

How do I add these 3 lines into .profile as environment variables: BBSCONFIG /home/tony/majorbbs.cfg BBSDISP xwindow DISPLAY hostname:0.0
0
votes
2answers
76 views

Why does my change in .profile has no effect? [closed]

I have a Red-hat Linux box. I logged in as a user1 and made JBOSS_HOME variable change in .profile file. Previously It was: export JBOSS_HOME="/opt/home/user1/jboss-eap-6.1" Now I changed it to: ...
3
votes
2answers
211 views

Complete view of where the PATH variable is set in bash

I've read in a couple of places that the PATH is set in /etc/profile or the .profile file that's in the home dir. Are these the only places that the path is set in? I want a better understanding of ...
1
vote
1answer
74 views

Why isn't “export” permanently chaning my environment variables?

Running Fedora 20. Trying to permanently set the LANG and LC_TIME variable with "export". When I run it, it works fine and I can see it was changed. When I reboot, it gets changed back. I am doing all ...
4
votes
1answer
253 views

LD_LIBRARY_PATH environment variable

I am trying to test the LD_LIBRARY_PATH environment variable. I have a program test.c as follows: int main() { func("hello world"); } I have two files func1.c and func2.c: // func1.c #include ...
0
votes
1answer
66 views

How to create a module on a CentOS cluster [closed]

I would like to create a module on a CentOS 6 cluster (e.g. module load gcc-4.7.2). Basically, I have no clue how modules work. Are there any good tutorials illustrating this or could someone ...
0
votes
0answers
18 views

Environment Variable not Exporting [duplicate]

I have this script that I'm writing, basically as my own free dynamic dns system (with a bit more manual-ness at the moment). Here it is: #!/bin/bash ...
0
votes
1answer
107 views

Pass environment variables to clean chroot in Arch

I am writing a PKGBUILD for Arch Linux. The package is large and compressing/uncompromising it take considerable time for limited space savings and I would like to turn it off while I am writing the ...
0
votes
0answers
85 views

How do I send a variable through SSH so it can be used across servers? C Shell

EDIT: Would this be possible in bash? Note: I have to use C shell. (.csh) I have something very similar to the following code: set var = "string" ssh -X server "$var" << END * I ...
0
votes
4answers
209 views

Unable to add folder to PATH in .profile file

The following is my .profile file: # ~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists. # see ...
4
votes
2answers
263 views

Where is the `$TERM` environmental variable set in Debian Jessie for console logins?

I have read a lot of articles and SE questions regarding how and where the default $TERM environmental variable gets set. Unfortunately in Debian 8.1 I can't seem to find where the default $TERM ...
0
votes
2answers
41 views

How to pass an environment variable when change rooting?

I don't seem to be able to pass an environment variable to a chroot: $ sudo apt-get install debootstrap dchroot $ sudo debootstrap trusty mychroot $ sudo chroot mychroot /bin/bash -c "MY_VAR=5; echo ...
0
votes
1answer
269 views

Bash - check environment variables

The env command can be used to print environment variables in bash. I want to ask if there is any built-in command to do this ? $ export temp="hello world" $ env | grep temp The second command ...
2
votes
1answer
216 views

Bash - shell vs environment variable [duplicate]

I want to clarify a confusion I am having in shell variable vs environment variable. I did the following test, where I have a shell variable abc and export it to an environment variable. $ $ ...
1
vote
1answer
685 views

How set environment variable permanently in Red Hat Linux?

As I'm using Red Hat Linux 5.3, I'm unable to set environment variable permanently. I want the file names for csh, from which I can add the environment variables permanently.
-1
votes
1answer
142 views

How can I delay the evaluation of variables (lazy evaluation)?

For example, I create 32768 directories named 0,1,2,...32767. I want to randomly choose one as the path every time I run a command. So I change $PATH to $PATH:/blabla/$RANDOM, but it won't work ...
7
votes
1answer
662 views

Bash: How many nested sessions deep?

Say I start a bash shell, ...and then another bash session from within that shell, ...and then another bash session from within that session, ...and then another bash session from within that session, ...
2
votes
1answer
79 views

how to set Internal Variables in mailx in linux?

save internal variable enable saving of messages in the dead.letter file on interrupt or delivery error.The default is save. problem: default is save so dead.letter file is created at home directory, ...
1
vote
1answer
628 views

Get value of environment variables in for-loop

I have several environment variables pam_branch app_branch worker_branch I use an array to define different projects and I want to get the values of these environment variables by rebuilding them ...
47
votes
4answers
4k 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
134 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 Every ...
2
votes
1answer
206 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 ...
4
votes
1answer
1k 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 ...
1
vote
1answer
9k views

Set environment variable $PATH globally on Ubuntu 14.04

I am trying to add environment path variable of composer globally. I've tried many ways but it does not seem to work. I searched other posts, but did not find matching answers. I am trying to ...
0
votes
1answer
115 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
112 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 ...
6
votes
1answer
120 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
229 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 ...
2
votes
2answers
845 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
864 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?