I have a switch statement, and I want to have two options performing the same thing. For example, if $opt matches "-fb" or "--fbase", I want to perform the same operation. How can I include various matches in "case" ?
switch ($opt)
case "-T":
set Atpath = $par
set opt_tpath = 1
breaksw
case "-fb":
set Afbase = $par
set opt_fbase = 1
breaksw
set opt_dsrmax = 0
set narg = $#argv
while ($iarg < $narg)
MATH iarg = $iarg + 1
set arg = $argv[$iarg]
set opt = `echo $arg | awk 'BEGIN {FS="="} {print $1}'`
set par = `echo $arg | awk 'BEGIN {FS="="} {print $2}'`
switch ($opt)
case "-d"|"--dsrmax":
set Adsrmax = $par
set opt_dsrmax = 1
breaksw
default:
set Afullnames_list = "$Afullnames_list $arg"
breaksw
endsw
end # while
if ($opt_dsrmax == 0) then
echo "\n ERROR: -dsrmax not set\n"
exit 1
endif
---------- Post updated at 07:47 PM ---------- Previous update was at 07:42 PM ----------
I have started coding using ksh but not bourne shell. I already got the .csh scripts and thought it would be faster to update those first so I can get some results sooner.
---------- Post updated at 07:56 PM ---------- Previous update was at 07:47 PM ----------
Is it possible to do in csh?
---------- Post updated at 08:51 PM ---------- Previous update was at 07:56 PM ----------
Have tried the below and seems to work
case "-d":
case "--dsrmax":
set Adsrmax = $par
set opt_dsrmax = 1
breaksw