Database - RAC/Scalability (MOSC)

MOSC Banner

getopts scripting in RAC service relocation

edited Dec 18, 2013 12:28AM in Database - RAC/Scalability (MOSC) 1 commentAnswered ✓
 Hello 

Hello,

I am using below code in AIX env to interpret -n option given in argument while executing the script .I want to give another argument -t

Code:
#!/bin/sh
#set -x
while getopts ":n:" opt; do
    case "$opt" in
        n)
            host=$OPTARG
            shift 2
        ;;
        *)
            break
        ;;
    esac
done

echo "host = $host "


I want to run script like ./ser_reloc.sh -n dev-u1 -t pref

How do I recognize second argument -t in the script 
Additionally,if I place -t before -n and use script like below:


Code:
./ser_reloc.sh  -t  perf -n dev-u1

would I have to change code for this?

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center