doc/example/modulepaths-persist-over-sudo/rc
raw| 1 | #%Module |
| 2 | |
| 3 | # ensure MODULEPATH is always defined, use content of .modulespath config file |
| 4 | # to initialize it if not defined |
| 5 | if {![is-used] && [file readable /usr/share/Modules/init/.modulespath]} { |
| 6 | set fid [open /usr/share/Modules/init/.modulespath r] |
| 7 | set fdata [split [read $fid] "\n"] |
| 8 | close $fid |
| 9 | foreach fline $fdata { |
| 10 | if {[regexp "^\\s*(.*?)\\s*(#.*|)\$" $fline match patharg] == 1 |
| 11 | && $patharg ne {}} { |
| 12 | eval module use --append [split $patharg :] |
| 13 | } |
| 14 | } |
| 15 | } |