The Differences Between Bash, Source, “.”, and “./” Execution

While working on Linux, you probably run across some files that are not executing in the way you expected — for example, you might have a file in your current directory but it does not run when you enter its name. You get file_name.sh command not found, but actually, the file is there. The file does not work, even having execution permission, because when you write something on the shell and run it, your $PATH variable gets checked. If there is any command matching inside $PATH directories, such as /usr/bin, it will execute. Unless there is a matching command, you are going to get the error.

So you need to address the path to your file. Let’s create a simple Linux shell script and have execution permission on the script. The below examples are written in Bash Shell.

CategoriesUncategorized