Sponsored Content
Full Discussion: Cycle for with for-then-else
Top Forums Shell Programming and Scripting Cycle for with for-then-else Post 302844228 by RudiC on Saturday 17th of August 2013 01:02:10 PM
Old 08-17-2013
Quote:
Originally Posted by elilmal
Sorry, but can i insert in to this cycle a command like this?

Code:
#!/bin/bash

SID=xx
symcfg list -sid $SID -pool -gb -det -thin |grep pool |awk '{print $1}' >list_vmax_xx_pools

while read i
do
if [ `symcfg show -sid $SID -pool $i -detail -thin -gb |grep "Max. Subscription Percent"` = 'Enable' ]; then
    echo "ok"
  else
    echo "not ok"
  fi
done < list_vmax_xx_pools

cat list_vmax_xx_pools

pool_1
pool_2
pool_3
You of course can, there's no syntax error, but the way you present it won't yield a reasonable result. symcfg may output whatever it wants, if you grep for "Max Subscription Percent" the output will never be an "Enable" alone.
Why don't you grep for "pool.*Max Subscription Percent" or even "pool.*Max Subscription Percent.*Enable" (as proposed by kshji) in the first place and then work on the results file? Or, maybe, that's already what you desired?
BTW, kshji's last data evaluation could be condensed to
Code:
[ -z "$data" ] && echo "not ok" || echo "OK"

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell cycle

Hello I got a cycle in the script which open another scripts. if then action fi Scripts action will be running 2 times at the same time. Inside of action() is insert into the table. But what I want is that only first script can do insert into table. So how to do... (2 Replies)
Discussion started by: mape
2 Replies

2. Shell Programming and Scripting

For cycle

Hello, I have files in a dir. I what to create a FOR cycle that will do this FOR <condition> do file=`ls <directory> | tail -1` echo $file mv -f $file <another dir> done What I want to now is what should I put in the <condition>. The condition I want is that the FOR will execute... (3 Replies)
Discussion started by: nagomes
3 Replies

3. Shell Programming and Scripting

wildcard in a if cycle

hello everybody, I need help on putting a wildcard match inside an if condition (I'm using korn shell): if ] then echo ' ' echo ''$MYSEL' is not a correct option' echo ' ' else ..... i tried also #if -ne "``" and a lot of combinations of `"' but I didn't find the... (2 Replies)
Discussion started by: elionba82
2 Replies

4. Shell Programming and Scripting

for cycle

Hello, I have a question: is there a way to have a "for" cycle done a certain number of times. For example in c++ I can do this: for (i=o;i<10;i++) and the cycle will be repeated 10 times. in UNIX for example I do this: for i in `cat /etc/host` do done and the cycle will be repeated... (6 Replies)
Discussion started by: jcpetela
6 Replies

5. Shell Programming and Scripting

for cycle question

i have a question how to modify below script to generate the expect result below : test.sh #!/bin/bash for ((i=0; i < 25; i++)) do echo $1$i done current result: test.sh 20090101 200901010 200901011 200901012 200901013 200901014 200901015 200901016 200901017 200901018 (2 Replies)
Discussion started by: bleach8578
2 Replies

6. Shell Programming and Scripting

sed problem in a for cycle

Hi, i have a problem with a sed command runned in a for cycle... I have a file named fileX which contains (i have crippled the line to minimal for easy): load data dbfoo - TOCHANGE - comment load data dbboo - TOCHANGE - comment load data dbzoo - TOCHANGE - comment ... And a file... (8 Replies)
Discussion started by: maxlamax
8 Replies

7. UNIX for Beginners Questions & Answers

For cycle, process order

Hello, I am running a script under ubuntu 16.04 I have no problem with the script. My question is general algorithm of for file command. I just need to know how for file in *.txt process works. Let's say, I wish to run the script by sorting filename: for file in *.txt do "do something in... (2 Replies)
Discussion started by: baris35
2 Replies
vxmemstat(1M)															     vxmemstat(1M)

NAME
vxmemstat - display memory statistics for Veritas Volume Manager SYNOPSIS
vxmemstat [-e] [-i interval [-t count]] DESCRIPTION
The vxmemstat utility prints memory statistics information. This information can be system-wide, or it can be specific to a Veritas Volume Replicator object. OPTIONS
-e Prints extended memory statistics. -i interval Prints memory statistics every interval seconds. -t count Prints the local system time every count intervals. The time interval is specified using the -i interval option. OUTPUT FORMAT
The statistics are prefaced by a timestamp showing the current local time on the system. Statistics are printed as a one-line output record for each memory pool. The records are preceded by two header lines. The output line consists of blank-separated fields. All numeric fields are in units of kilobytes. The following fields are displayed on each line: Pool Name of the memory pool. Memory consumers allocate memory from different pools for different purposes. DG Name of the disk group in which the RVG is present. Min Size Minimum amount of memory always reserved for use by consumers of the pool. As consumers require more memory, additional memory is allocated to the pool for distribution to them. Max Size Maximum amount of memory that can be allocated to the pool. This is equal to the value assigned to the maximum pool size system tunable that corresponds to the pool. In Use Amount of memory (out of that allocated) currently being used by consumers of the memory pool. Allocated Amount of memory currently allocated to the memory pool. The amount of memory allocated to a pool ranges between the minimum and the maximum pool size. The amount of allocated memory increases as more memory is needed and decreases as it is relinquished. Max Used Maximum amount of memory used by consumers from this pool since system startup. This field is not shown if the -e option is specified. Max Pool Used Maximum amount of memory used by consumers from this pool at any time since the last reboot. The value shows the maximum usage even if usage by the pool has varied over this time period. This field is shown if the -e option is specified. Waiting Indicates if any I/O is waiting to allocate memory from this pool. This usually indicates that the corresponding tunable for the maximum size of this pool needs to be increased. This field is not shown if the -e option is specified. Waiters The number of requests that are waiting to allocate memory from this pool. This field is shown if the -e option is specified. EXIT CODES
The vxmemstat utility exits with a non-zero status if the attempted operation fails. A non-zero exit code is not a complete indicator of the problems encountered, but rather denotes the first condition that prevented further execution of the utility. See vxintro(1M) for a list of standard exit codes. EXAMPLES
To display statistics every 5 seconds and time stamp the output every alternate interval, use the command: vxmemstat -i 5 -t 2 SEE ALSO
vxintro(1M), vxstat(1M) VxVM 5.0.31.1 24 Mar 2008 vxmemstat(1M)
All times are GMT -4. The time now is 08:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy