2

Consider the following:

$ module
cmdModule.c(166):ERROR:11: Usage is 'module command  [arguments ...] '

  Modules Release 3.2.6 2007-02-14 (Copyright GNU GPL v2 1991):

  Usage: module [ switches ] [ subcommand ] [subcommand-args ]

Switches:
(...omissis...)

$ which module
no module in (...long list of my path)

$ alias
alias cp='cp -i'
alias h='history | grep '
alias ls='/usr/local/bin/ls --color=always'
alias mv='mv -i'
alias rm='rm -i'
alias vi='vim'

$

Clearly, the module command is there and is available to execute, but I can't find it (easily). Digging a little bit, I found it on the system, and I noticed that it's an alias to

bin/modulecmd $SHELL

in module installation path.

But why it doesn't appear in the alias list and why - even if it doesn't appear - it work?

Davide
  • 151
  • 8

2 Answers2

2

Edit: I wonder if something tricky is being done in the alias. Try this:

alias|hd

Edit 2:

The reason I suggested the above is that it's possible to hide aliases. See my question and answer here for details.


Original answer:

Try type -a module it's more comprehensive.

Also, if it's a function, you can see its definition using this:

declare -f module

and you would need to grep these files, plus any that they source, plus any that I left out, to find where it's defined:

  • /etc/profile
  • /etc/bash.bashrc
  • ~/.profile
  • ~/.bashrc
  • ~/.bash_profile
  • ~/.bash_login
Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
  • Thanks, type is what I was looking for, but it doesn't work for all the shells (the same is true for declare - both are shell builtins). Note that I didn't tag bash, but shell! Both are unavailable in csh, thus I'm just upvoting and not accepting. The list of files you suggested to grep, implies that you believe I'm on a much simpler system than I really am (the list of relevant dotfiles would be at least ten time longer) – Davide Oct 22 '09 at 19:22
  • See my edited answer. I'm sorry I missed that "module" was the real name. There are a few things in your question that make it look "sanitized". And I did say "plus any that I left out". Anyway, thanks for the +1. – Dennis Williamson Oct 22 '09 at 21:06
0

It's a function.

And it comes from here. It's quite convenient to manage environment variables.

Daniel
  • 1,703
  • 1
  • 12
  • 16
  • Yes, I perfectly know what module is and where it comes from (although I didn't say so in the question - my bad). I was just wondering why "something" didn't appear neither in "whereis" nor in "alias" – Davide Oct 22 '09 at 19:31