Hi Guys,
I am writting a c shell script where I have to parse an input argument with options that could be an array. So far I have achieved where I could parse a single argument with option but failed when I try to create an array with the options. For example:
This is on terminal window: temp.csh A B C D -Tbase
set array = ()
@ i = 0
while ($i <= ${#argv})
switch ($argv[$i])
case -T*:
set th = `echo $argv[$i] | awk '{print substr($1,3)}'`
breaksw
default:
set array = ($array $argv[$i])
endsw
@ i++
end
set lst = $array[1]
set out = $array[2]
set t = $array[3-] ##This could also be an array
The above code works for single string after -T option but if I want to create an array :example -Tbase 0.2scrub , it fails. Can anybody help please?
Also on aside note if I want a space between -T base 0.2scrub , how can I change my script?
Thanks in advance!