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=220.127.116.11 export DATA_NODE_1=18.104.22.168 export DATA_NODE_2=22.214.171.124 export DATA_NODE_3=126.96.36.199
And another script file setnodes
> ls -lista setnodes 7733504 4 -rwxrwxr-x. 1 pol pol 92 Feb 20 09:59 setnodes
> 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
but not if I run
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).