I need to separate the input into different values after reading it from command line. I am reading it using the OPTARGS
method along with while
loop.
So my input will be like "hostanme1 hostname2 hostnamen"
How can I loop in through this to extract the hostnames in separate variables.
while getopts S:H: opt
do
case ${opt} in
S)
SCHNAME=${OPTARG}
;;
H)
HOST=${OPTARG}
;;
*)
DisplayUsage
exit 1
;;
esac
done
This will be run like ./filename.ksh -S schema -H "Host1 host2 host3 host4