There is an example shell script in the xRC manual (possibly other PEX manuals as well) in the "Troubleshooting and Integration" chapter. Look for Example 11-1 in "Best Practices for Shell Scripts". There is also a procedure for generating shell scripts from Calibre Interactive on the page before that, "Creating Batch Shell Scripts Using Calibre Interactive."
For walking through a list of layouts, you would want to modify your SVRF to use a variable for LAYOUT PRIMARY and possibly LAYOUT PATH (depending on whether the cells were in one file or separate files). This would look like "LAYOUT PRIMARY $cell_name". There's a simple example in MG244254, Run on all cells in a library.
Hope this helps-