In my home dir, I have sub directories (CentOS, Ubuntu, etc) all for specific nodes I have access to.
Each OS will hold their own copy of programs, one of which is Python:
$HOME/{CentOS, Ubuntu, ...}/{python2,python3}
I am using environment modules so that when I
ssh
into a different computer (COMP), Python aliases will be set for that specific (COMP). For example:COMP1 is CentOS
when I
ssh
into COMP1, "python3" should point to$HOME/Centos/python3/bin/python3
COMP2 is Ubuntu
when I
ssh
into COMP2 "python2" should point to$HOME/Ubuntu/python2/bin/python2
I can retrieve the OS name in bash using lsb_release -si
, but I am working with modulefiles which are written in tcl, and haven't found something like lsb_release
. Can I have a bash script that outputs lsb_release -si
when called from a tcl script?
I tried doing this but no luck:
BASH SCRIPT:
#!/bin/bash OS=$(lsb_release -si) echo $OS
MODULEFILE SCRIPT:
#%Modulefile1.0
set OS [catch {exec bash /path/to/bash_file} output]
puts $OS
This doesn't do much.
Option A: export the variable in bash and access the environment variable in tcl.
Option B: Use the platform package that comes with tcl.
References: env platform