Sponsored Content
Full Discussion: Code optimization
Top Forums Shell Programming and Scripting Code optimization Post 303018763 by MadeInGermany on Thursday 14th of June 2018 12:44:59 PM
Old 06-14-2018
Simply break the loop if ORACLE_SID got a value!
(You do not need to check the boundaries. Imagine you have 10+ items...)
Code:
#!/bin/bash
R=$'\e[0;31m'
N=$'\e[0m'

OPTIONS=(
 db_a db_b db_c db_g
 db_o db_e db_k db_t
)
PS3=$'\n'"${R}Choose database ${N}"

select ORACLE_SID in "${OPTIONS[@]}"
do
  [[ -n $ORACLE_SID ]] && break
  printf "${R}Invalid number!${N}\n"
done

#^D pressed?
[[ -n $ORACLE_SID ]] || exit

export ORACLE_SID HOST=${ORACLE_SID}_qa
echo "HOST=$HOST"

These 2 Users Gave Thanks to MadeInGermany For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on optimization of the script

Hi, I have prepared script which is taking more time to process. find below script and help me with fast optimized script:- cat name.txt | while read line do name=$(echo $line| awk '{print $8}') MatchRecord=$(grep $name abc.txt | grep -v grep ) echo "$line | $MatchRecord" | awk... (2 Replies)
Discussion started by: aju_kup
2 Replies

2. Programming

compilation parameters, code optimization

Hi all, I implemented an application, through using c++ and compiled it with g++. At first, what I did is (@ compilation): g++ calcBacon.C -o test -DDEBUG after I ran my application it took almost 120 sec. to finish its execution when I compiled with optimization parameters, execution... (5 Replies)
Discussion started by: SaTYR
5 Replies

3. Shell Programming and Scripting

script optimization

:o Hi, I am writing a script in which at some time, I need to get the process id of a special process and kill it... I am getting the PID as follows... ps -ef | grep $PKMS/scripts | grep -v grep | awk '{print $2 }'can we optimize it more further since my script already doing lot of other... (3 Replies)
Discussion started by: vivek.gkp
3 Replies

4. UNIX for Dummies Questions & Answers

unix script optimization

I have a file which contains 9,200,000. It contains 125 clolumns. I have to rearrange some columns and exclude some of them. I scripted the following script to do the same. It is working fine but it is taking more than 4hrs to do it. can it be optmized. Here is the script LOC="/sourcefile/"... (3 Replies)
Discussion started by: max_payne1234
3 Replies

5. Shell Programming and Scripting

AWK optimization

Hello, Do you have any tips on how to optimize the AWK that gets the lines in the log between these XML tags? se2|6|<ns1:accountInfoRequest xmlns:ns1="http://www.123.com/123/ se2|6|etc2"> .... <some other tags> se2|6|</ns1:acc se2|6|ountInfoRequest> The AWK I'm using to get this... (2 Replies)
Discussion started by: majormark
2 Replies

6. Shell Programming and Scripting

sed optimization

I have a process using the following series of sed commands that works pretty well. sed -e 1,1d $file |sed 1i\\"EHLO Broadridge.com" |sed 2i\\"MAIL FROM:${eaddr}"|sed 3i\\"RCPT TO:${eaddr}"|sed 4i\\"DATA"|sed 5s/.FROM/FROM:/|sed 6s/.TO/TO:/|sed 7,7d|sed s/.ENDDATA/./|sed s/.ENDARRAY// >temp/$file... (1 Reply)
Discussion started by: njaiswal
1 Replies

7. Programming

Make file optimization

Hi , I need some help on optmizing the make file. I have the below scenario. SOUTHERN_XITEM_PROGS=\ sfmxitem.rel \ sfqxitem.rel SOUTHERN_XITEM_DEPS= southern_xitem.c SUPERSVU_XITEM_PROGS=\ su3xitem.rel SUPERSVU_XITEM_DEPS= supersvu_xitem.c $(SOUTHERN_XITEM_PROGS) : $$@.o... (1 Reply)
Discussion started by: angelinrajeesha
1 Replies

8. Shell Programming and Scripting

CPU optimization

hi guys , I have 10 scripts suppose 1.sh , 2.sh ,3.sh ,4.sh ......10.sh each takes some time ( for instance 2 minutes to 40 minutes ) my server can run around 3-4 files at a time suppose, 1.sh , 2.sh , 3.sh are running currently now as soon as ANY ONE of the gets finished i... (4 Replies)
Discussion started by: Gl@)!aTor
4 Replies
VIRT-HOST-VALIDATE(1)					      Virtualization Support					     VIRT-HOST-VALIDATE(1)

NAME
virt-host-validate - validate host virtualization setup SYNOPSIS
virt-host-validate [OPTIONS...] [HV-TYPE] DESCRIPTION
This tool validates that the host is configured in a suitable way to run libvirt hypervisor drivers. If invoked without any arguments it will check support for all hypervisor drivers it is aware of. Optionally it can be given a particular hypervisor type ('qemu' or 'lxc') to restrict the checks to those relevant for that virtualization technology OPTIONS
"-v", "--version" Display the command version "-h", "--help" Display the command line help "-q", "--quiet" Don't display details of individual checks being performed. Only display output if a check does not pass. EXIT STATUS
Upon successful validation, an exit status of 0 will be set. Upon failure a non-zero status will be set. AUTHOR
Daniel P. Berrange BUGS
Report any bugs discovered to the libvirt community via the mailing list "http://libvirt.org/contact.html" or bug tracker "http://libvirt.org/bugs.html". Alternatively report bugs to your software distributor / vendor. COPYRIGHT
Copyright (C) 2012 by Red Hat, Inc. LICENSE
virt-host-validate is distributed under the terms of the GNU GPL v2+. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE SEE ALSO
virsh(1), "virt-pki-validate", "virt-xml-validate" libvirt-1.1.1 2012-09-21 VIRT-HOST-VALIDATE(1)
All times are GMT -4. The time now is 07:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy