-1
votes
1answer
22 views

Using /usr/bin/env to change directory [on hold]

I want to automatically execute commands with the prefix /usr/bin/env $/usr/bin/env composer install (this runs OK) $/usr/bin/env cd public (failed ---> /usr/bin/env: cd: No such file or ...
0
votes
1answer
16 views

How do I unset “!::” environmental variable in bash?

I have a build script that is failing because it tries to unset an environmental variable called !::. That fails: $ unset -v '!::' sh: unset: `!::': not a valid identifier How do I unset that ...
0
votes
1answer
22 views

exporting bash paths with same variable name

I'm looking at my bash profile and not really understanding what I see. I think I see a variable (PATH) being redeclared - though this can't be true as all my programs seem to work. Can you help me by ...
2
votes
1answer
138 views

What's the ZSH equivalent of BASH's $PROMPT_COMMAND?

BASH supports a $PROMPT_COMMAND environment variable that defines a command to be executed before any first-level interactive prompt. I'm looking for a ZSH equilvalent of that. The documentation says ...
0
votes
0answers
94 views

setting https_proxy environment variable in a secure way

The following is the standard way suggested to set the environment variable for the https_proxy: export https_proxy=<username>:<password>@<proxy>:<port> But it clearly ...
2
votes
1answer
41 views

Bash: Need to export variables to parent process. Is the parent the same process?

I'd like to launch a script that sets and/or updates some environment variables. Unlike this question, I don't mind launching the script as . /path/to/my/script/myScript.sh to force the script to ...
0
votes
1answer
31 views

Set ENV variable for all commands in current directory in mac os

Is there a way to run all commands in current directory with some ENV variables predefined? Example of what I need: I put some file, say .env in my directory, with: export SECRET='abcd123' Then I ...
0
votes
0answers
72 views

Correct way of setting Ruby2.1 as the go-to application when it referenced to/called via shell?

I have installed Ruby 2.1 on my headless Debian server (7.4) by downloading the source from https://www.ruby-lang.org/en/downloads/ and then running the routine of ./configure make make install ...
1
vote
1answer
182 views

Awesome WM: execute my aliases via run prompt?

I have aliases in my bashrc for a few programs. One example is: alias chrome='google-chrome --disk-cache-size=1000000000' How can I call this alias from the run prompt (modkey+r)? Im running ...
2
votes
2answers
74 views

env -i zsh | How is this magic possible?

I'm currently working, for school, on a home-made shell, therefore I'm kind of curious nowadays about how shell vars are set. Yes, this can be really exciting ! Anyway, we obviously have to deal with ...
0
votes
0answers
30 views

Exporting Variables – Reading Them Returns Blank?

Hi – I'm using Mac OS X (Mavericks), which should be UNIX compliant. In my .bash_login, I'm exporting variables for Cocos2D-X. I know this is executing, as I have a 'echo Test' line that executes ...
0
votes
0answers
43 views

Ubuntu: `env -i bash --norc`, but include essential variables such as HOME, DISPLAY? (where are these set?)

Is there an easy way to isolate a session of bash so that only essential variables (HOME, USER, DISPLAY, etc.) are preserved? (essential in that many programs fail if HOME, DISPLAY, TERM, SHELL, etc. ...
0
votes
2answers
39 views

how to set up an environment variable that it stores a path along with another env variable but doesnt expands

I want to know how to set up an environment variable that stores other environment variable but these environment variables doesn't gets expanded when I echo instead if I use eval echo then it should ...
0
votes
1answer
89 views

Modify persistent variables on a remote server host using 'ssh' from client host

As the title says, I want to modify environment variables on a remote server using 'ssh'. My first attempt was: $ ssh mysvr -l sikaiwei "getId=$ORANGE; echo $ORANGE; ORANGE=$((ORANGE+1)); echo ...
2
votes
1answer
65 views

Export bash function over SSH

I would like to export a bash function over ssh to use it in GNU parallel. That question seems to be answered here Exporting bash functions through ssh but I don't seem to be able to get it to work. ...
1
vote
2answers
701 views

Apple Mavericks - why doesn't this one-line BASH script set my Python virtual environment like I expect?

I have the following Bash script: #!/bin/bash echo $MYPROJECT_HOME/bin/myproject_venv/bin/activate source $MYPROJECT_HOME/bin/myproject_venv/bin/activate echo ...
2
votes
2answers
303 views

Go-lang go tool works with Bash but not Fish

For those of you who have no idea what Fish is: http://fishshell.com/ Similarly, if you are not familiar with a Go coding environment and still wish to try and figure out this small puzzle, here is ...
1
vote
4answers
133 views

Mac OS X keeps “old” environment variable around

So far I had /Applications/play-1.2.5/ added to my $PATH variable. Now I'm working with 2.2.1, which I installed in /Applications/play-2.2.1 and changed in ~/.bash_profile (which is getting sourced at ...
0
votes
2answers
152 views

Unable to get ls to recognise LS_OPTIONS or LS_COLORS?

Trying to get --color=auto as the default ls argument. $ ls --version ls (GNU coreutils) 8.21 … $ echo $LS_COLORS ...
0
votes
3answers
754 views

How to keep variable preserve while running script through ssh

I am trying to run while loop with read through ssh: #!/bin/bash ssh root@10.10.10.10 "cat /var/log/syncer/rm_filesystem.log | while read path; do stat -c \"%Y %n\" "$path" >> ...
1
vote
1answer
1k views

Why does subshell not inherit exported variable (PS1)?

I am using startx to start the graphical environment. I have a very simple .xinitrc which I will add things to as I set up the environment, but for now it is as follows: catwm & # Just a basic ...
0
votes
2answers
217 views

linux- env variables getting reset after closing the console

The env variables I set are getting reset to the previous values after closing the current instance of the bash console. How to set or unset those variables without getting them reset everytime? I am ...
0
votes
2answers
582 views

Attempting to read data from a text file and inputting the variable text to a script

I have a file with 25 single word entries, I need a script to read through the file one line at a time and input the variable phrase into a second script that will generate a individual file based on ...
0
votes
1answer
104 views

Environmental variables in login shells and interactive shells

I'm sort of confused of login shells and interactive shells. If I run ssh my_remote_server 'echo $HOME' I can get /home/shawk But when I run ssh my_remote_server 'echo $ANOTHER_VAR' I got a ...
1
vote
1answer
269 views

Exporting bash functions through ssh

So I found a way to transfer environment variables through ssh without having to change neither server nor client: Transferring environment variable through SSH / quoting in bash/sh/csh/tcsh But I ...
0
votes
1answer
41 views

Why does 'which' give incorrect result?

I am executing on a Ubuntu 12.04 shell the following command: sudo bash -c "echo $PATH; which python" which displays something like ...
1
vote
2answers
1k views

Spaces in Linux environmental variables?

Given directory: /media/foo/can haz/bar, I have tried editing bash.rc with: export Foo=/media/foo/can haz/bar export Foo=/media/foo/can\ haz/bar export Foo='/media/foo/can haz/bar' export ...
0
votes
2answers
367 views

bash: variable name not being expanded with Tab completion

On a remote computer with bash version "3.2.51(1)-release" (OS: SUSE Linux Enterprise Server 11.1 (x86_64)), I could not do a usual tab completion with variable name. for example, I'd like to type: ...
0
votes
1answer
325 views

ls not using the LS_COLORS environment variable

I am using the configuration below for ls. I have changed the $LS_COLORS variable to display directories as cyan colored using di=01;36. However, when I run ls, directories show in purple. If I run ...
0
votes
3answers
246 views

Is there any way to encapsulate bash functions?

I'm writing a simple script script.bash that is supposed to export some variables environment, to use it in my current session I have to source it $ . script.bash script.bash function fun1() { ...
0
votes
0answers
17 views

rvm cluttering up my environment vars

I was trying to see a list of my environment variables in Bash (Mac Terminal) by typing set. But when I do, I am overwhelmed by a bunch of functions apparently defined by RVM. Is this supposed to ...
0
votes
1answer
51 views

Is it possible to make the environment ignore $http_proxy env variable for certain urls?

In Firefox, I can set a proxy for all URLs except certain domains. Is it possible to do the same with the http_proxy environmental variable? That is, could I set another variable to exclude certain ...
2
votes
2answers
132 views

Unable to get profile variable using ssh

Unable to retrieve the profile variable using ssh. server2 ==> user apptst ==> bash profile has $APPHOME variable. Was trying to retrieve the value from server1 using ssh but failed. Used options ...
0
votes
1answer
385 views

Ubuntu environment setting for GUI session (or making the same with terminal)

I'm using Ubuntu 10.10 When I log in using normal GUI desktop, it seems that the environment is not the same with the terminal. I modified $PATH and other information in .bashrc. But, this doesn't ...
0
votes
1answer
116 views

Zsh alternative to bash's quick assignment and inheritance trick

There's a trick available in bash allowing you to set environment variable for child process and run it in single line, retaining original values of variable in the shell. For example, in order to set ...
4
votes
1answer
447 views

sudo -E not passing all variables

Reading the man pages I expected sudo -E to pass all environment variables to the subshell, but I am not getting the expected results. As expected, awesome: $ export ...
1
vote
1answer
270 views

How to save environment variable on my Ubuntu Linux system

I am using Maven to the build process of my Java project. To launch the mvn command in any position within the shell I am using the following command to declare the environment variable in this way: ...
2
votes
2answers
1k views

sudo, runuser, su don't work as I expect when run as root with command as “echo $HOME”

When I run these commands it outputs as shown. /root sudo -u someuser -i "echo $HOME" /root runuser -l someuser -c "echo $HOME" /root su - someuser -c "echo $HOME" /root What i expected was ...
1
vote
1answer
817 views

How do I set an environmental variable with a dot?

I couldn't find a way to set an environmental variable with dot (.). For example: export mule.home=/Users/chandra/mule/ export {mule.home}=/Users/chandra/mule/ export $mule.home=/Users/chandra/mule/ ...
1
vote
3answers
2k views

Term Enviroment Variable not set, when executing a Bash File via SSH

i am trying to run a bash script on a remote machine. If I open a ssh connection in a terminal, i can easily run the script. But when i run it like that: ssh user@ip < /etc/script I get an ...
0
votes
1answer
508 views

In linux, how can we change bash environment variables using initialize script?

We know that we can change bash's environment variables, for example PATH, using initialize script, for example .bashrc. Just writing PATH=<VALUE> and you will get what you want. But, consider ...
1
vote
3answers
374 views

How to find out environment variables set after logging into a shell session

How can I find out the environment variables set after logging into a shell session? My two dummy solutions have been so far as follows: _VariableName1="VarValue1";export _VariableName1; ...
2
votes
1answer
380 views

Can't save PATH or JAVA_HOME variables, Oracle Linux 6

I am on Oracle Linux 6 and I am trying to add the path: /root/jrockit-jdk1.6.0_33-R28.2.4-4.1.0 to the PATH and JAVA_HOME variables. So, I login as root and I try: export ...
7
votes
3answers
384 views

What is the simplest scriptable way to check whether a shell variable is exported?

For some shell sessions I want to be able to print a warning flag if a shell variable is not set and exported. It is fairly simple to do something like this to print "Error" in the prompt if SET_ME ...
0
votes
1answer
102 views

COMP_LINE not set despite bash completion being installed

I'm using homebrew's bash completion package on OSX, which is installed in /usr/local/etc/bash_completion. It's working fine, but there are many extensions for it which rely on various environment ...
13
votes
2answers
15k views

Environment variables in bash_profile or bashrc?

I have found this question [blog]: Difference between .bashrc and .bash_profile very useful but after seeing the most voted answer (very good by the way) I have further questions. Towards the end of ...
3
votes
1answer
757 views

~/.bashrc not sourced in a new lxterminal window

I added some lines to my ~/.bashrc like export JAVA_HOME=/opt/jdk1.6.0_22 I sourced it: $ source ~/.bashrc $ env | grep 'JAVA' JAVA_HOME=/opt/jdk1.6.0_22 Then I created a basic bash script under ...
3
votes
2answers
2k views

How can I find out where an environment variable (like PATH) was set?

I have a xterm with the bash shell in linux. When I echo $PATH, it is showing a directory and I want to know who put this directory in the PATH. How can I find out? Thanks!
0
votes
2answers
477 views

Virtualenv for bash

I really like virtualenv when working with python code and am wondering if there existed some tool which could emulate some of it when working in bash. What I want is some cleanly reverseble way of ...
1
vote
1answer
577 views

How to check whether an environment variable is read only or R+W?

How to check whether an environment variable is read only or R+W on linux system? As an example BASH_VERSINFO is readonly. do i need to check manual? Any other option?