Hello JAMFers,
I'm writing a script to have a local variable, and an IF statement to say "If a 4th parameter/argument was passed to the script, use that instead."
For example:
if [[ ! -z "${4}" ]];then
theVariable="${4}"
fi
However, I suspect that JAMF might be sending non-null characters for all empty script parameter fields (e.g. a period ".").
An example of what I mean is this:
/usr/local/bin/setup_script.sh "Mount_Point" "Computer_Name" "Username" . . . . . . . .
# 1st, 2nd, and 3rd fields being reserved for JAMF's internal fields.
# Each period represents subsequent parameters.
Each period can be passed to a script to serve as placeholders, and substituted with quoted text to pass parameters to a script in the intended parameter. So let's say that I have a generic setup script that want to pass certain values to some machines and not all.
/usr/local/bin/setup_script.sh "Mount_Point" "Computer_Name" "Username" "LocalAdmin" "AutoUpdates" . . . . . .
/usr/local/bin/setup_script.sh "Mount_Point" "Computer_Name" "Username" . "AutoUpdates" . . . . . .
Do you think my IF statement will be sufficient to check for non-null fields? Or would someone please help me verify how JAMF is verifying parameter positions?
Thank you!