3
$ which mycommand
/home/t/program_files/document/other edits//mycommand

Why do I have double slash // here?

Tim
  • 101,790

2 Answers2

6

which searches your PATH. It happens that mycommand is found in a $PATH entry with a trailing slash: /home/t/program_files/document/other edits/. which concatenates the directory, a / as separator, and the command name to build the filename to check; when the directory has a trailing slash, this results in two slashes.

Multiple slashes are equivalent to a single one, so this is completely inoccuous.

P.S. Why not use "which"? What to use then?

2

Thats because you have put a trailing forward slash (/) while adding the location /home/t/program_files/document/other edits in $PATH.

You might have used:

PATH=$PATH:/home/t/program_files/document/other\ edits/

You need to use to get rid of trailing /:

PATH=$PATH:/home/t/program_files/document/other\ edits

Although this is not that much of a problem AFAIK as shell will treat // as /.

heemayl
  • 56,300