![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| running command in while loop | gefa | Shell Programming and Scripting | 2 | 11-21-2007 07:27 AM |
| Help with a simple loop command! | dfs | Shell Programming and Scripting | 8 | 05-18-2007 02:27 PM |
| Pb in while loop with ssh command | madmat | Shell Programming and Scripting | 1 | 10-13-2005 03:45 AM |
| rsh command in a while loop | Nicol | Shell Programming and Scripting | 6 | 11-19-2003 01:08 PM |
| Using cat command in a for loop | sleepster | UNIX for Dummies Questions & Answers | 1 | 09-12-2003 02:19 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
for loop with db2 command
Having some trouble with usage of for loop and displaying words. Basically I had 3 words( some times more )
in the variable. I want to get one at a time to process. I am new to unix scripting so please bear with my question and appreciate your reply. I think this can also me done my awk command but I don't know how.. So appreciate your help. Shell script is ================= table_name='TAB_NAME' schema_name='SCH_NAME' db2 "connect to DB2D" tempfile1=`db2 -x "select concat(pkgschema,concat('.',pkgname)) from syscat.packagedep where bname='"$table_name"' and bschema='"$schema_name"' with ur "` echo ' ---tempfile after the db2 command ------- ' $tempfile1 for variable in $tempfile1; do echo $tempfile1[0] done db2 "connect reset" After the db2 command tempfile1 looks like ( 3 words seperated by blank) sch1.package1 sch2.package2 sch3.package3 In the for loop also it shows like sch1.package1 sch2.package2 sch3.package3 [0] sch1.package1 sch2.package2 sch3.package3 [0] sch1.package1 sch2.package2 sch3.package3 [0] Expected output is ==================== sch1.package1 sch2.package2 sch3.package3 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|