For this script run with the arguments -a
E.g
./getopts -a 10 -b 1
#!/usr/bin/env mwnci OPTIONS=rest(ARGV) A=0 B=0 moreopts=true while (moreopts) { switch (OPTIONS[0]) { case "-a" { A=int(OPTIONS[1]); OPTIONS=shift(OPTIONS,2); } case "-b" { B=int(OPTIONS[1]); OPTIONS=shift(OPTIONS,2); } default { moreopts=false; } } } println("A=", A) println("B=", B)