"which" command gives me the source code and not the path of a command

79 views Asked by At

I'm working with some python virtualenvs, and I was wondering how the workon command was made.

So I made a which workon to get the path of workon. I had directly the whole source code of workon --- so I got an answer to my question --- but I expected a path.

What does it mean? Isn't workon contained in a file?

1

There are 1 answers

3
robertklep On BEST ANSWER

workon is a shell function (see here), not a separate script.

I'm not sure if every shell will show you the function source when you run which, but at least the zsh does.