/

Do we actually need to put (/) at end of directory path ?

ex:

1- cd path/ex
2- cd path/ex/

cd Downloads
cd Downloads/

sometimes works but others give error message "No such file or directory"
it depends on what tool you are using whether it needs it or not.
Using your example, if ex is a directory, then no. If ex is a symlink to a directory, then the two mean different things, so yes.

EDIT: It might not make a difference with cd, but things that take a directory spec, like ls, sure.
Last edited on
he seems to be using unix. Windows can be a little inconsistent across the command line tools. I don't know but I believe unix tools try to follow the same way of doing things near universally, but I only use the major ones, there are so many.... anyway, I was speaking from windows perspective
Last edited on
As said, it depends on the path (file, directory, symlink, ...) and the command. There are only a handful of shell builtin commands. Majority are separate applications and they are free to handle their command-line parameters as they like.

For example, rsync copies files and directories. Whether the source (directory) has trailing slash or not changes what is copied.
Registered users can post here. Sign in or register to post.