1
vote
4answers
155 views

why do we not need export here?

$ IFS=";" $ read first second i am;a_i b c $ echo $first i am $ echo $second a_i b c $ echo $IFS Am I right that read first second is a subprocess of the current shell process? If yes, why don't ...
19
votes
2answers
828 views

Does ~ always equal $HOME

I know this has probably been asked before, but I couldn't find it with Google. Given Linux Kernel No configurations that change $HOME bash Will ~ == $HOME be true?
4
votes
1answer
148 views

Keep getting the same result after “export PATH”

I am doing this: $ which cabal /usr/bin/cabal $ export PATH=$PATH:$HOME/.cabal/bin $ which cabal /usr/bin/cabal I expect to get /.cabal/bin/cabal for $ which cabal (this path exists) after this. ...
3
votes
3answers
173 views

Messed up bash.bashrc file, commands not working anymore

Trying installing Java, I tried to add it to the executable path with the line: export PATH=/usr/lib/jvm/jdk1.7.0_60/bin:$PATH in the system-wide /etc/bash.bashrc file. For some reason this ...
6
votes
2answers
186 views

if statement in .bashrc not working correctly

I set up .bashrc to show a long prompt if the terminal is at least 80 characters wide. Otherwise it shows a degraded, smaller prompt. I use an if statement to achieve this: dp_smaller_than=80 if [ ...
5
votes
3answers
324 views

Is there any harm in using variables that aren't set?

Say I have the following code: # Check if the color prompt is enabled and supported on this system if [ -n "$force_color_prompt" ] && [ -x /usr/bin/tput ] && tput setaf 1 ...
3
votes
4answers
90 views

Protected environment variables?

Are there names of environment variables that cannot be overwritten by the user/a call to setenv? As I understand from POSIX1.2008, any process may edit the environment block, but must avoid ...
4
votes
3answers
182 views

Environment variables are not set when my function is called in a pipeline

I have the following recursive function to set environment variables: function par_set { PAR=$1 VAL=$2 if [ "" != "$1" ] then export ${PAR}=${VAL} echo ${PAR}=${VAL} shift ...
2
votes
4answers
153 views

How do I pass a variable from my local server to a remote server?

I am trying to pass a variable from my local server (location1) to a remote server (location2). The purpose of the code is to copy a file from the remote server from a predefined location. In simpler ...
21
votes
3answers
766 views

If processes inherit the parent's environment, why do we need export?

I read here that the purpose of export in a shell is to make the variable available to sub-processes started from the shell. However, I have also read here and here that "Processes inherit their ...
1
vote
2answers
141 views

Variable value is not recognized after using gnu parallel?

I have a below shell script from which I am trying to copy 5 files in parallel. I am running my below shell script on machineA which tries to copy the file from machineB and machineC. If the file is ...
18
votes
5answers
1k views

why is setting a variable before a command legal in bash?

I've just encountered several answers such as to parsing a delimited text file... that use the construct: while IFS=, read xx yy zz;do echo $xx $yy $zz done < input_file where the IFS ...
17
votes
7answers
647 views

How do I source another process's environment variables?

If I examine /proc/1/environ I can see a null-byte-delimited string of process 1's environment variables. I'd like to bring these variables into my current environment. Is there an easy way to do ...
6
votes
3answers
290 views

Understanding environmental variables in different contexts

Trying to understand the behaviour of the environment in Linux (Ubuntu 13.04 concretely), I've find different situations where setting envirionment variables are used or defined for/in different ...
2
votes
2answers
119 views

What does `env COLUMNS=%S ps …` do?

I have seen the syntax env COLUMNS=%sin shell scripts, e.g. see the line below from the Helm package in Emacs: env COLUMNS=%s ps -axo pid,user,pri,nice,ucomm,tty,start,vsz,%%cpu,%%mem,etime,command ...
3
votes
2answers
194 views

How can I make shell aliases available when shelling out from Vim?

In my .zshrc, I declare some aliases. Eg, which dbstart shows the contents of that alias. If I open vim from that shell, it is a child process. In Vim, I can run shell commands with :! some_command. ...
1
vote
2answers
67 views

Environment variable for command called via nice

I need to set an environment variable for a command that is being called via nice. [Bash and dash, Slackware and FreeBSD.] $ JIM=20 nice -n 10 echo $JIM $ Nope, echo can't see JIM $ nice -n ...
4
votes
2answers
141 views

Expansion of a shell variable and effect of glob and split on it

This post actually contains two separate questions but I think grouping them together will give some more context. I have gone through this question on quotes around variables but I do not quite ...
2
votes
2answers
844 views

Removing a directory from PATH

I'm trying to compile wxWidgets using MingW, and I have cygwin in my path, which seems to conflict. So I would like to remove /d/Programme/cygwin/bin from the PATH variable and I wonder if there is ...
1
vote
2answers
302 views

How to loop through xargs where each script uses a common env variable

Is it possible to initiate 10 of the same shell scripts which also initiate more copies, and have them all use the same env variable? For example: script.sh: #!/bin/bash export ...
0
votes
0answers
74 views

Application does not see environmental variables

I am running following 32 bit command on 64 bit system: LIBGL_DEBUG=verbose glxinfo32 -v -t | head -5 It's output says direct rendering: No (If you want to find out why, try setting ...
1
vote
2answers
49 views

Running a program to output in Dutch

I'm running KDE Arch linux and trying to update my system using pacman and have it output in Dutch. I've tried the following sudo LANG=nl_NL.UTF-8 pacman -Syy sudo KDE_LANG=nl_NL.UTF-8 pacman -Syy ...
0
votes
1answer
111 views

How to undo DISPLAY export in linux?

I have exported my X display to another computer using this command: export DISPLAY=xxx.xxx.xxx.xxx:0.0 How can I undo it?
2
votes
2answers
2k views

Exporting a variable with dot (.) in it

How to export a variable which has dot in it. I get 'invalid variable name' when I tried : export my.home=/tmp/someDir -ksh: my.home=/tmp/someDir: invalid variable name Even escaping metacharacter ...
34
votes
4answers
1k views

What exactly is an environment variable?

I know that VARIABLE=value creates an environment variable, and export VARIABLE=value makes it available to processes created by the current shell. env shows the current environment variables, but ...
2
votes
1answer
1k views

bash: export: `--wait': not a valid identifier

When I run git-sh from my terminal it works fine. But I get the following warning. bash: export: `--wait': not a valid identifier What is this and how do I get rid of it?
2
votes
1answer
178 views

Screen - inherit current window's environment

In GNU Screen, how can I create a new window whose shell inherits the environment of the shell in the current window? The usual Ctrl+A C doesn't seem to do this.
11
votes
2answers
661 views

What's the best distro/shell-agnostic way to set environment variables?

The question says it all. I currently use Arch Linux and the zsh, but I'd like a solution that (at minimum) works both on VTs and in xterms and also (hopefully, preferably) will continue to work if I ...
1
vote
1answer
141 views

Why does export not seems to affect child shells?

if I have $ x='This is a String' $ export x $ xterm & [3] 14089 The child process doesn't seem to respond to $echo $x $ Update: The FIRST time I export the variable it seems to span a ...
19
votes
3answers
804 views

Show PATH in a human-readable way

I want to show my PATH environment variable in a more human-readable way. $ echo $PATH ...
2
votes
3answers
1k views

Why do 'ssh host echo $PATH' and printing the $PATH after ssh'ing into the machine give different results?

On a particular host, when I ssh into the machine and enter echo $PATH I get /home/wxy/bin64:/home/wxy/bin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin and if I ...
-3
votes
1answer
5k views

“not a valid identifier” when I do “export $PATH”

When I run export $PATH in bash, I get the error not a valid identifier. Why? Here's my ~/.bashrc file # ~/.bashrc: executed by bash(1) for non-login shells. # see ...
2
votes
4answers
112 views

$PATH duplication issues

If I do echo $PATH I get the following: ...
0
votes
3answers
2k views

Get environment variable of other user [closed]

Is there a way I can see the environment variable of an other user? I want to do that as root, so permissions won't be a problem I guess. For the user himself, I use echo $PATH or set | grep PATH ...
11
votes
4answers
3k views

Why do I have to re-set env vars in tmux when I re-attach?

I mainly work on a mac and ssh/tmux attach to a Linux machine to do my work. I have ssh-agent running on the Linux machine. I have set -g update-environment "SSH_AUTH_SOCK SSH_ASKPASS WINDOWID ...
2
votes
1answer
39 views

Installing packages and tools on a local non-standard directory

TLDR: What environment variables should I update to guarantee that my system has access to everything a package provides when building it on a non-traditional path? I usually don't have root access ...
-1
votes
3answers
1k views

How to run a shell script with export command in crontab

I have a shell script that exports values of variables when executed. The same values will be used in another script. How to run this script(test.sh) in cron. #!/bin/sh export I="10" echo $I I will ...
1
vote
2answers
721 views

OS X setting environment variables

I have OSX 10.8.2 with ZSH as my shell and iTerm as a terminal (don't know if the last thing is relevant). I have to mention that I'm relatively new to OSX. I'm trying to set up some environment ...
2
votes
1answer
1k views

How to run Steam from the Xfce desktop?

I've installed Steam on Debian 7.0 without any hassle, and I can run it by typing steam &. I've set it as a desktop launcher in Xfce, but when I ran it, nothing happened. Then I've check the ...
0
votes
1answer
384 views

difficalty to save traceroute output in shell variable?

I need to filter and store traceroute output in shell variable (array). But I am getting some unusual output. As I try to explain in following lines. My present directory is temp, having some ...
2
votes
2answers
1k views

What is the difference between '.' and 'source' in shells? [duplicate]

Possible Duplicate: running script with “. ” and with “source ” I have used both the dot command '.' and 'source' to reload a given rc file (typically to update my environment variables) ...
2
votes
2answers
99 views

Can I change the shell used to run GUI applications from a Desktop Manager?

A bit of background I'm a developer and I install most of my tools in my home folder. So my shell's rc file is full of JAVA_HOME, GROOVY_HOME, MAVEN_HOME, ... variables. To expose all these ...
7
votes
3answers
16k views

How do I set an environment variable on the command line and have it appear in commands?

If I run export TEST=foo echo $TEST It outputs foo. If I run TEST=foo echo $TEST It does not. How can I get this functionality without using export or a script?
10
votes
1answer
274 views

How do you set up the environment for es?

I've been playing with es the last couple of days, and it (like rc) has the quirk/feature that it only runs its startup script (.esrc) on login. The usual way to run code in each interactive session ...
8
votes
3answers
1k views

Why $SHELL doesn't change when I run new shell?

$ echo $SHELL /bin/bash $ /bin/ksh93 $ echo $SHELL /bin/bash $ file /bin/ksh93 /bin/ksh93: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for ...
3
votes
1answer
1k views

How do you make DISPLAY variable undefined?

I am using Ubuntu, but I think this applies to all Linux. What's the command to set DISPLAY to be undefined in the shell?
2
votes
3answers
881 views

How can I restore the changes to shell variable?

For the purpose of an experiment... Suppose I did this bash="unset DISPLAY; export DISPLAY" so I can make DISPLAY undefined. How can I restore the original value set? Or at least know what it was? ...
2
votes
2answers
329 views

What is the difference between `terminator -e ranger` and ranger from terminal?

EDIT: I just noticed that when I hit Enter on the ranger (if it is executed with terminator -e ranger) then nano opens while with e it uses my main editor. In contrast, when I use a normal shell to ...
0
votes
2answers
4k views

Trying to set JAVA_HOME in ~/.bashrc

I have added this line at the end of ~/.bashrc export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java But when I execute echo $JAVA_HOME, I don't get anything as output, I expected ...
0
votes
1answer
379 views

Shell script executing in the terminal but not from shell script file [duplicate]

Possible Duplicate: How can I make variables “exported” in a bash script stick around? I have a problem with executing script from file. When I type in command line ...