Environment
NetIQ SecureLogin
NSL7.x
Situation
Script for application A calls for the password from application B, but prompts user to enter password for application A.
If application A has no password, how do I make it use the password from application B?
By design, when a secureLogin script references a variable that has no value the user will be prompted for that variable.
How do I supress the prompt for a nonexistent variable?
How do I supress the prompt for a nonexistent variable?
User is promtped for password when the following is in the script:
## If no password exists, use the password from "otherapp"
If $Password Eq ""
Set $Password $Password(otherapp)
EndIf
If $Password Eq ""
Set $Password $Password(otherapp)
EndIf
Resolution
The "If exist/notexist" test allows for this scenario. Use the following syntax:
## If no password exists, use the password from "otherapp"
If -notexist $Password
Set $Password $Password(otherapp)
EndIf
If -notexist $Password
Set $Password $Password(otherapp)
EndIf
NOTE: The "-" is required. Using "exist" or "notexist" does not work; using "-exist" or "-notexist" does work.
For more information see setion for "If / Else / EndIf" in the SecureLogin command reference guide
From that section:
If -Exist|-NotExist <Variable>
#Do This
[Else]
#Do This
EndIf
#Do This
[Else]
#Do This
EndIf