-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eval a command #519
Comments
I would suggest to create a temporary shell script that does the Here is a small shell script example that outputs shell code on stdout like $ cat myscript
echo "export FOO=value" A modulefile can be crafted to generate a temporary script that evaluates the above script to generate the corresponding environment change orders: $ cat foo
#%Module
set tmpfile /tmp/source-myscript-[module-info username]
set fid [open $tmpfile w]
puts $fid {#!/bin/bash
eval $(./myscript)}
close $fid
source-sh bash $tmpfile
file delete $tmpfile $ module show ./foo
-------------------------------------------------------------------
/path/to/foo:
setenv FOO value
-------------------------------------------------------------------
$ module load ./foo
$ echo $FOO
value
$ module unload ./foo
$ echo $FOO
$ |
Works like a charm, thanks. |
I am adding a source-sh bash-eval jube complete |
Introduce 'bash-eval' mode on source-sh modulefile command and sh-to-mod sub-command. Output generated by script is evaluated to get environment changes with this mode. Fixes #519
Hello,
I am setting up a module file for the JUBE tool. This tools comes with a command to add shell completion:
https://apps.fz-juelich.de/jsc/jube/jube2/docu/commandline.html#complete
The recommanded usage is :
eval "$(jube complete)"
However, the source-sh command in a module file is looking for a script file, and cannot execute a plain command. Similarly, the system command does not know of any eval binary; as it is a builtin function of the shell.
How would you call this eval command to properly setup shell completion in a module file ?
Thanks.
The text was updated successfully, but these errors were encountered: