I know this is 10 years old, but I wanted to add my very self-confident 0.02 dollars.
No. Absolutely not.
We are talking about a Unix system. As for the directory itself, this is a node, like any other. When accessing the directory, it should never have a slash in the name (link: dirname , pwd , ~ , echo $HOME , echo $PATH , output from ls , etc.),
When accessing the contents of a directory, you need a slash. That is, ls /home/karl/ more suitable than ls /home/karl (FTR, I almost always do the latter, because ... well, lazy).
When using a variable containing a directory to create the full path to a file, you should always include a slash (for example, e: cp ${HOME}/test ${OTHER_DIR}/ ).
The directory is not expected to end with a slash. Any expectation that the directory ends with a slash is incorrect. Thus, adding a slash to the end of the value of the variable *_DIR would undermine expectations.
Is it worth noting that just because it is wrong does not mean that tools / packages / libraries never do this. This is too common when such things add a slash when nothing should exist. Therefore, as Bevan and Paul F. suggested, when using third-party tools, it is best to remove any slashes that may exist in directory names.
Unix inodes
An index (index node) is a data structure in a Unix-style file system that describes a file system object, such as a file or directory.
- https://en.wikipedia.org/wiki/Inode
File System Hierarchy Standard
The Unix file system standard (File System Hierarchy Standard, AKA FHS) clearly shows that directories do not have a trailing slash, and directory contents begin with a slash (the only exception to this is / , because we will not refer to the root of the file system with using an empty line ... and in any case, you should not create files there.)
- http://www.pathname.com/fhs/pub/fhs-2.3.html
- https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard