How To Find Bash Script Directory Within Script
One of the common challenges bash script writers face when writing a script which references files in the same directory (or its sub-directories) as the script file. As the script can be called from anywhere, you cannot use the current directory to refer to the files. You really need to refer to the directory the script is located. One way is to hardcode the script directory and set it in the installation script. But that fails when you don't have an installation script or when user moves the script directory to a different location. I am sure you will agree that it is a clumsy solution. Is there a better way? Full article (269 words) »

