Recognize efficiently if a parameter was used in the command line calling a script in csh

22 Views Asked by At

I have a csh script that is called like this : <Script_name> -OptionA -OptionB -OptionC Each one of this option may or may not be used, when the script is called, and they can be in any order. I would like to be able to test easily in a if condition (or equivalent), if OptionX is present at any given position : $argv[?], $1 $2, .... ?

I tried something like this but it is not working :

if($?OptionB) then
    #Do anything
endif

Can you think of an efficient (compact) solution to test existence of the option at any argument of the command line ?

Have a good day, Julien

0

There are 0 best solutions below