Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

How to use a string in the for loop?

$
0
0
Hi Guys,

I have the below 2 exception which I want to monitor and subsequently many more. My problem is since the For loop takes the syntax for variable in word1 word2 as separate entities and my error strings are consisting of many words , how to treat the whole error string as a single entity.

Code:


Exception 1: org.com.Exception JMS MQ Error
Exception 2: org.db.Exception Db2 SQL Error

What can I do to modify the below code so that I can include individual exceptions in a for loop? The below code will treat each word as a different variable

Code:

for exception in org.com.Exception JMS MQ Error org.db.Exception Db2 SQL Error
---------- Post updated at 01:55 AM ---------- Previous update was at 01:43 AM ----------

Ok. I got it .. It shud be in the following format.

Code:

for exception in "org.com.Exception JMS MQ Error" "org.db.Exception Db2 SQL Error"

Viewing all articles
Browse latest Browse all 16232

Trending Articles