Why is `./` needed?

0106

The ./ is needed because, by default, the shell does not include the current directory in its list of directories to search for executables. This is a security measure to prevent the accidental execution of malicious scripts or programs that might be present in the current directory.

When you use ./, you explicitly tell the shell to look for the executable in the current directory. Without it, if you simply typed the name of the executable, the shell would search through the directories listed in the PATH environment variable and would not find the executable unless it is located in one of those directories.

0 Comments

no data
Be the first to share your comment!