Linux : watch and sql

by bitznbitez

There is a whizbang handy utility called watch in linux.   It displays the result of a command, sleeps for a while, clears the screen and does it again.   I used to do this with a shell script for years before the watch command was incorporated as a utility.

I will warn DBAs wanting to play with this.   Watchout for watch and the * wildcard of sql.    The command line you run like  this : psql -ac “select ……” when fed to watch looses the quotation marks.    Invoking anything on the unix command line with a simple * can result in undesired consequences.   In general if I am using a sql I put the sql in a file and invoke it as psql < myfile.sql instead.

Watch is handy but be careful of vanishing quotes.

Advertisements