How to achieve loop or iteration over a list of values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 11:00 AM - edited 06-24-2025 12:44 PM
Hi Experts,
I am in process of writing a custom pattern and facing a challenge to iterate over a list of db names which are resulted as part of linux command execution on the server. It results n number of databases.
Example:
home/dbinstance1/sqllib/db2profile && db2 list database directory
database name : databaseA
database name : databaseB
I store above db names in a table named as db_list.db_names
Now next will be another command based on the db names I got in previous step. db name will become an argument to the command as below.
(. /home/db2inst1/sqllib/db2profile && db2 get db cfg for "databaseA") |
(. /home/db2inst1/sqllib/db2profile && db2 get db cfg for "databaseB") |
There are two problems here I am struggling with:
Problem 1: how to interpolate db_names in above command?
Problem 2: How to iterate over a list of DB names in the pattern to execute next command for each database.
As we do not know how many databases are there and I want to iterate over a list of databases for the next command formation and execution; of which the results will be collected and stored in cmdb_ci_db_schema table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2025 09:42 AM
Anyone....??