Policy Script Parameter Value Limits

zinkotheclown
Contributor II

I have a script that necessitated more parameter values than the 8 slots available so I split the script into 4 separate ones in one policy. What I noticed is that the values in parameters 10 & 11 in each script were ignored or blanked out. Has anyone else realized this? Is this a bug in the JSS?

2 REPLIES 2

chriscollins
Valued Contributor

@zinkotheclown not a bug. You are most likely running into a quirk with Bash where any positional arguments past 9 you have to use alternate variable expansion uhsing brackets.

So for 9 you can use "$9" but past that you have to use "${10}" and "${11}".

m_entholzner
Contributor III
Contributor III

In general I'd recommend to use brackets for bash variables. For example:

#!/bin/bash

var1=First
var2=Second
echo "$var1$var2"

could sometimes lead into an output of "First$var2". some implementations of bash have issues with variable interpretations, so the second dollar may be interpreted as literal character. This means, you should clearly specify your variables and the end of them.

#!/bin/bash

var1=First
var2=Second
echo "${var1}${var2}"

The code above will avoid strange variable issues, AND, in any case, the result of the output will be "FirstSecond".

Just my two cents ;)