Checking arguments in Hscript.
Methods for passing and checking arguments.
Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Wednesday July 30th, 2008 01:47 PM
# ARGUMENT CHECKING
# author Daniel P Lynch
#arg1 is the new chosen param
#arg2 is the checked param to see if needs to be changed
set SOP = `oppwf()`
set wanted = `chs("$SOP/$arg1")`
set check = `chs("$SOP/$arg2")`
set checknum = `argc($check)`
for i = 0 to `evals(argc($wanted)-1)`
# sets $wnew for checking
set wnew = `arg($wanted,$i)`
for x = 0 to `evals(argc($check)-1)`
# sets $cnew for checking
set cnew = `arg($check,$x)`
set matchme = `strmatch($cnew,$wnew)`
if "$matchme" == "1" then
set matched = $matched $cnew
endif
end
end
for r = 0 to `evals(argc($matched)-1)`
set rcheck = `arg($matched,$r)`
set nvar = `strreplace($check,${rcheck},"")`
set check = $nvar
end
opparm $SOP $arg2 ("$nvar")
Downloads:
Download: some.sh 893 B
Please login or Click Here to register for downloads
Checking arguments by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
