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
asadmin-delete-jdbc-connection-pool(1AS)			   User Commands			  asadmin-delete-jdbc-connection-pool(1AS)

NAME
delete-jdbc-connection-pool - removes the JDBC connection pool SYNOPSIS
delete-jdbc-connection-pool --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive] [--cascade=false] connection_pool_ID Removes the JDBC connection pool. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. --echo setting to true will echo the command line statement on the standard output. --interactive prompts you for the required options that are not already specified. --cascade If set to true, deletes all the connector resources associated with the pool, apart from the pool itself. If set to false (default), the deletion of the pool fails if there are any resources associated with the pool. Either the resource has to be deleted explicitly, or set the option to true. OPERANDS
connection_pool_id name of the JDBC connection pool to be deleted. Example 1: Using the delete-jdbc-connection-pool command asadmin> delete-jdbc-connection-pool --user admin --password adminadmin --host fuyako port 7070 XA_connection_pool Deleted the JDBC connection pool resource with id = XA_connection_pool Where: the XA_connection_pool resource is deleted. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-jdbc-connection-pool(1AS), asadmin-list-jdbc-connection-pools(1AS) J2EE 1.4 SDK March 2004 asadmin-delete-jdbc-connection-pool(1AS)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy