Tagged Questions
2
votes
2answers
46 views
Function to evaluate variables in BASH
Given a variable name is there a function that will print its value?
Often times I pass the name of a variable to a bash function and instead of doing the expansion while passing it I would like to ...
0
votes
1answer
72 views
Variable assignment in .bash_profile has no effect
I added the following to my .bash_profile:
JAVA_HOME=$JAVA_HOME:/usr/java/jdk1.7.0
export JAVA_HOME
However, when I echo $JAVA_HOME it outputs an empty string. Why weren't my changes to ...
3
votes
4answers
100 views
Last failed command in bash
The $? variable holds the exit status of last run command. Is there a variable that holds last run command itself?
4
votes
2answers
44 views
Question on setting variables in loop conditions
I have a while loop that allows setting variables when written one way but does not allow it when written another way. Why is that? This prints var as 1234 and does not print var2
#!/bin/bash
...
4
votes
1answer
92 views
Where have I set my bash PATH?
I want to remove ~/bin from my PATH. I set it up months ago when Linux (Ubuntu) was very new to me, but I don't know how I added it...
Nothing shows up when I search all the files listed below.
...
3
votes
1answer
142 views
dot file not sourced when running a command via ssh
When I run my program interactively, it works fine:
ssh somehost
$ ~/some/path/somescript.py
When I run my program over ssh directly, it doesn't work. The variable PYTHONPATH is not set, because ...
0
votes
2answers
194 views
Multiple path environment variable setup lines with bash
I have very long export PATH=A:B:C .... Can I make a multiple lines to have more organized one as follows?
export PATH = A:
B:
C:
2
votes
5answers
278 views
ssh user@IP sh <command> missed environment variables
I use an approach
ssh user@IP sh [runme.sh]
to execute script remotely, this works fine. But I got one problem, that is in runme.sh, I can't get any envirnoment variables which are defined in ...
2
votes
3answers
473 views
Export an env variable to be available at all sub shells, and possible to be modified?
Suppose I have
export MY_VAR=0
in ~/.bashrc.
I have an opened gnome terminal, and in this terminal, I change $MY_VAR value to 200. So, if I do
echo $MY_VAR
in this terminal, 200 is shown.
Now, ...
8
votes
3answers
656 views
How to print all environment variables defined (but not necessarily exported) in bash
The bash builtin command set, if invoked without arguments, will print all environment variables, but also all defined functions. this makes the output unusable for humans and difficult to grep.
How ...