Trying to figure out whether this behaviour on IPython (v7.12.0, on Amazon SageMaker) is a bug or I'm missing some proper way / documented constraint...
Say I have some Python variables like:
NODE_VER = "v16.14.2"
NODE_DISTRO = "linux-x64"
These commands both work fine in a notebook:
!echo $PATH
# Shows **contents of system path**
!echo /usr/local/lib/nodejs/node-{NODE_VER}-{NODE_DISTRO}/bin:
# Shows /usr/local/lib/nodejs/node-v16.14.2-linux-x64/bin
...But this does not:
!echo /usr/local/lib/nodejs/node-{NODE_VER}-{NODE_DISTRO}/bin:$PATH
# Shows:
# /usr/local/lib/nodejs/node-{NODE_VER}-{NODE_DISTRO}/bin:**contents of system path**
I've tried a couple of combinations of e.g. using $NODE_VER syntax instead (which produces node--/ instead of node-{NODE_VER}-{NODE_DISTRO}/, but seems like any combination using both shell variables (PATH) and Python variables (NODE_VER/NODE_DISTRO) fails.
Can anybody help me understand why and how to work around it?
My end goal, as you might have guessed already, is to actually add this folder to the PATH rather than just echoing it - something like:
!export PATH=/usr/local/lib/nodejs/node-{NODE_VER}-{NODE_DISTRO}/bin:$PATH
$namethat it can't find in its own namespace, disables the substitution. eg!echo {NODE_VER} $foo. I haven't been able to find the code that performs the$and{}substitutions - but I expect this behavior will be obvious from that. I suspect it's intentional, trying to avoid ambiguities. But I haven't seen it documented.