I have it at the very top of my .bashrc, before returning for non-interactive shells
FOO="BAR"; export FOO echo "HELLO WORLD" # If not running interactively, don't do anything [ -z "$PS1" ] && return
I have a test.sh script in my home directory with this:
#!/bin/bash echo "A" echo $FOO echo "B"
I execute test.sh. Output:
A B
2 Questions:
- Why can't I see the value of $ FOO?
- Why can't I see "HELLO WORLD"?
edit: I thought the C #! / bin / bash script launches a sub-net that will call .bashrc again, right?
edit: Even if I call the script from another host, I will not see any values. Even then, .bashrc will be executed.
ssh remotehost "/home/username/test.sh"
source share