I use the source
command in my bash script in order to read/print the variables values
more linuxmachines_mount_point.txt
export linuxmachine01="sdb sdc sdf sdd sde sdg"
export linuxmachine02="sde sdd sdb sdf sdc"
export linuxmachine03="sdb sdd sdc sde sdf"
export linuxmachine06="sdb sde sdf sdd"
source linuxmachines_mount_point.txt
echo $linuxmachine01
sdb sdc sdf sdd sde sdg
What is the opposite of source
in order to unset the variables?
Expected results
echo $linuxmachine01
< no output >
source
that is setting the variables in your environment, but theexport
statements in the file which yousource
. So the opposite ofsource
could besource
, if yousource
a different file whichunset
s all the same variables.export
s. Allexport
does is copy the values into the environment -- but they're present as shell variables whether or not they're defined as environment variables as well. Moreover, defining unnecessary environment variables shortens your maximum command line length, as they're stored in the same (limited!) per-process space.