I have a file hadnodes.conf (setting node IP addresses for AWS VMs)
> ls -lista hadnodes.conf
7733498 4 -rwxrwxrwx. 1 pol pol 141 Feb 20 08:05 hadnodes.conf
Content (not real IPs):
> more hadnodes.conf
#!/bin/bash
export NAME_NODE=18.202.25.99
export DATA_NODE_1=52.30.117.99
export DATA_NODE_2=34.248.153.99
export DATA_NODE_3=52.17.111.99
And another script file setnodes
> ls -lista setnodes
7733504 4 -rwxrwxr-x. 1 pol pol 92 Feb 20 09:59 setnodes
Content:
> more setnodes
#!/bin/bash
source /home/pol/dcu/ca675_cloud_technologies/assignment_1/nodes/hadnodes.conf
Now, I can get setnodes to work if I type
source /path/to/setnodes
but not if I run
. /path/to/setnodes
But if I run just > setnodes (being an executable script), the variables don't take - i.e. $NAME_NODE, DATA_NODE_1 &c are undefined. I have put relevant directory in my $PATH and tab completion is occurring, so it's not like the script can't be seen. The command "> which setnodes" also shows it in the correct directory.
I also tried to use "exec" in setnodes to run my hadnodes.conf script (as described here) but to no avail.
I would like to know what I'm missing in terms of "chaining" (running sequentially) bash scripts so the environment variables in script "N" are passed back up the chain to the calling shell/environment (script 0).
hadnodes.conf
file, but they're lost when the 'setnodes' shell exits. – Haxiel Feb 20 '19 at 10:51