Having to set a lot of paths on $PATH then wrote this code to load it from a text file:
#!/bin/bash
cd ~
echo '#++++++' >> ./pathlstbkp
cat ./pathlst >> ./pathlstbkp
while read pth; do
cmd='export PATH="'$pth':$PATH"'
eval ${cmd}
done < ./pathlst
echo '' > ./pathlst
As you can see described here when using eval the evaluated command doesnt run on subshell.
But it dont change the $PATH variable.
Now realized someting strange happens, it dont work on my test Ubuntu-LTS18-Minimal-X64 but works on my main machine, a Debian9.