-
Notifications
You must be signed in to change notification settings - Fork 102
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
How to source a csh script into a modulefile? #399
Comments
Hello,
When working with simple script you can even use the sh script through But here, the scripts are a bit more complex : they initialize a function for sh-shell or an alias for csh-shell. For the dispatch, I suggest to rely on the
Now to understand why it does not work on your setup. I suspect that the conda initialization script was already sourced prior loading the module that rely on
So if the conda.csh was already run prior using module, the initial environment already contains the conda definitions, thus it is equal to the resulting environment so the diff between both is empty. Regards, |
Hello Xavier, Super!!! Your suggestion works like a charm! It also has the advantage that it looks for the type of the calling shell independently of what is the login $SHELL. Thanks a million!!! I am sure that if you were to document it in the cookbook many users would be thankful for it (anaconda can finally be loaded as a module without having to source a script!). As I was working with tcsh I noticed that when using modules (version 4.7.0) in a tcsh shell the history gets garbled, I am not sure if I should open a new ticket (please let me know). This is what I mean:
this behavior appears only on tcsh shell and if I exit the shell and reenter it the history shows up OK:
for your reference I am on a CentOS 7.9.2009 box. Any idea of what is going on and how to get around it? Thanks, RD |
Perfect, I will improve the recipe as suggested. Regarding the tcsh issue, this is something that were spotted 2 years ago. I have reported the issue upstream with code to reproduce it, but it has not been solved yet. There is a workaround available with the This configuration should be defined prior module command initialization as it changes the module command alias on tcsh. The counterpart of this workaround is that it weakens shell evaluation of the code produced by modulefiles. Characters with special meaning for Tcsh shell (like |
I have just updated the cookbook recipe to provide additional examples to use |
I am using module framework on windows and I have downloaded windows package as well as install tclsh on my machine.. Is there a way to source a bat file or shell script on windows command prompt ?
Appreciate your inputs as I need to create a single modulefile for both linux and windows such that this is possible? |
Hello,
Sorry for posting here, but I am not sure whether this is a question or a feature request. I have been using the sourcing of scripts to create environmental modules as described here:
https://modules.readthedocs.io/en/latest/cookbook/source-script-in-modulefile.html
in particular:
Is there a way to source csh/tcsh scripts? I could not find mention in the documentation (https://modules.readthedocs.io/en/latest/cookbook/source-script-in-modulefile.html) or a man page that would describe the syntax. Should one use something line:
Notice that the use case is to create a modulefile for anaconda that will prevent the users from running:
which (quite ignorantly - I should say) writes in the user initialization files. The idea is to use instead in the modulefile for anaconda something along the lines of:
which would support both sh-based as well as csh-based shells.
The problem is that:
does not appear to work.
Do you have any suggestions? If csh script can be sources could you update the documentation an upload and example?
Thanks,
RD
Please use preferably the Modules mailing-list to post question:
The text was updated successfully, but these errors were encountered: