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) »

How To Write Infinite Loop in Bash

This is how you create an infinite loop in bash to run a piece of code perpetually at pre-defined intervals. Full article (55 words) »

Monitoring MySQL Queries Using Bash Script

Monitoring MySQL queries is a favorite pastime of MySQL administrators especially for performance reasons. Here is a simple bash script to monitor long running MySQL queries in realtime using the ubiquitous 'show processlist'. The best part about this script is that you can use it to log your queries over time for later evaluation. Full article (213 words) »

Protected by Comment Guard Pro