为什么我这里有双斜线?

Tim*_*Tim 1 shell bash slash filenames which

$ which mycommand
/home/t/program_files/document/other edits//mycommand
Run Code Online (Sandbox Code Playgroud)

为什么我//这里有双斜线?

Gil*_*il' 5

which搜索您的路径。碰巧mycommand$PATH带有尾部斜杠的条目中找到:/home/t/program_files/document/other edits/which连接目录、a/作为分隔符和命令名称以构建要检查的文件名;当目录有尾部斜杠时,这会导致两个斜杠。

多个斜杠相当于一个斜杠,所以这完全无关紧要。

PS为什么不使用“哪个”?那用什么?