Tldr: page request: whence

Created on 28 Nov 2017  路  10Comments  路  Source: tldr-pages/tldr

help wanted new command

All 10 comments

Thanks for requesting this page! Do you want to have a go yourself, @ahmetb?

Pages are best created by people who understand the command they are about.

If you do, take a quick read of CONTRIBUTING.md, which guides you through the process of creating a new page here. Then, just simply send a pull request to this repository - and if you need any assistance, just ask :-)

I wish I understood this command well enough to write about it but I currently do not.

Ah, ok! We'll leave this issue open until someone with the necessary experience comes along 鈽猴笍

whence is found in man 1 ksh

       whence [ -afpv ] name ...
              For  each  name,  indicate  how it would be interpreted if used as a command
              name.
              The -v option produces a more verbose  report.   The  -f  option  skips  the
              search  for  functions.   The  -p option does a path search for name even if
              name is an alias, a function, or a reserved word.  The -p option  turns  off
              the  -v  option.   The  -a option is similar to the -v option but causes all
              interpretations of the given name to be reported.

whence is also in the output for man 1 zshall

whence [ -vcwfpamsS ] [ -x num ] name ...
              For each name, indicate how it would be interpreted if used as a command name.
              whence  is  most useful when name is only the last path component of a command, i.e. does not include a `/'; in particular, pattern matching only succeeds if just the non-directory component of the command is passed.
              -v     Produce a more verbose report.
              -c     Print the results in a csh-like format.  This takes precedence over -v.
              -w     For each name, print `name: word' where word is one of alias, builtin, command, function, hashed, reserved or none, according as name corresponds  to  an  alias,  a  built-in  command,  an external command, a shell function, a command defined with the hash builtin, a reserved word, or is not recognised.  This takes precedence over -v and -c.
              -f     Causes the contents of a shell function to be displayed, which would otherwise not happen unless the -c flag were used.
              -p     Do a path search for name even if it is an alias, reserved word, shell function or builtin.
              -a     Do a search for all occurrences of name throughout the command path.  Normally only the first occurrence is printed.
              -m     The arguments are taken as patterns (pattern characters should be quoted), and the information is displayed for each command matching one of these patterns.
              -s     If a pathname contains symlinks, print the symlink-free pathname as well.
              -S     As  -s,  but if the pathname had to be resolved by following multiple symlinks, the intermediate steps are printed, too. The symlink resolved at each step might be anywhere in the path.
              -x num Expand tabs when outputting shell functions using the -c option.  This has the same effect as the -x option to the functions builtin.

And comparing that to the man 1 ksh output, there are some key differences. Namely -f option skips the search for functions in ksh but in zsh -f Causes the contents of a shell function to be displayed which are pretty conflicting as far as I can tell.

Oooh hrm. I'm not sure what should be done here. Are the two versions available only on different platforms to one another?

It seems this is a shell specific command. Currently, we don't have a way to identify multiple commands with the same name if they are in a single platform.

We can have a single page for whence for the more popular shell and mention that there is a separate command for the other shell and create a separate page for that with the name whence_ksh.md. Just a thought.

Is it appropriate to indicate in a tl;dr page how whence relates to which?

I feel that is the first thing users are going to want to know - as I believe most people will wonder when/why/if they should use it rather than which. I think which is common knowledge, but whence is not.

Sure, you can add a "See also: which" line.

I'm closing this because whence was added in May 2020 with #4021. Thank you @danielbayley !!

Glad to get an old issue like this closed! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

endearingyoungcharms picture endearingyoungcharms  路  3Comments

zlatanvasovic picture zlatanvasovic  路  3Comments

TobiasRoland picture TobiasRoland  路  3Comments

kelthuzadx picture kelthuzadx  路  3Comments

dikarel picture dikarel  路  3Comments