I would like to execute a MySQL command in a shell script/cron job that returns a dynamic number of rows in which I can access a specific field from those rows. I would then like to loop through this performing additional commands on those field entries.
My two questions then are:
How do I return a set of rows (ideally just a single cell in each row) to a shell script variable?
Could I write a PHP script that returns the information I need and then save this to a shell script variable? If so, how do I run the PHP script from the shell and have it return the information?