![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Array inside an array | manas_ranjan | UNIX for Advanced & Expert Users | 5 | 06-10-2008 11:25 AM |
| KSH Setting multiples variables with an array | wolfhurt | Shell Programming and Scripting | 1 | 05-20-2008 07:00 AM |
| create array holding characters from sring then echo array. | rorey_breaker | Shell Programming and Scripting | 5 | 09-28-2007 05:42 AM |
| declare, assign variables using array, counter, loop | egkumpe | Shell Programming and Scripting | 3 | 08-09-2004 07:56 AM |
| Array variables | kavitha | Shell Programming and Scripting | 2 | 03-23-2004 06:16 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Getting variables into a array.
Hi ,
Im trying to monitor 2 instancesof a process on our solaris server and trying to do a notification if the returned process size is greater than 500M. Since there are two variables returned I want to make use of arrays to check each and every variable that is stored. the issue that im facing is that how can i assign the output of 'top | grep siebmtshmw | grep -v grep | awk '{print $6}' to a array ?? if i do something like #!/bin/bash proc[]=top| grep siebmtshmw |awk '{print $6}'|sed 's/\%//' echo ${proc[@]} ---Returns a wrong value for ((i = 0 ; i < ${#proc[@]} ; i++ )) do echo ${proc[$i]} *** i will put the logic to check if the variables are greater than 500*** echo $i echo ****** done ____________________ hercule1:sadmin\>top | grep siebmtshmw | grep -v grep | awk '{print $6}' the above command returns the below vars 344M 53M I need to store what ever is returned by top | grep siebmtshmw | grep -v grep | awk '{print $6}' into variables of a array . Any help/suggestion is appreciated. |
| Forum Sponsor | ||
|
|
|
|||
|
Hi
Does all versions of bash support array? also in my case proc[]=top| grep siebmtshmw |awk '{print $6}'|sed 's/\%//' echo ${proc[@]} -- > print the list of files in directory but not the 2 processes...is this wierd ? |
|||
| Google UNIX.COM |