Bug 9.4 - script parameters slot 10 & 11

loceee
Contributor

There seems to a problem with Casper 9.4 (haven't checked 9.5) ...

Script parameter slots 10 & 11 are passed junk when populated or not

Test script as so:

#!/bin/bash
echo "$1"
echo "$2"
echo "$3"
echo "$4"
echo "$5"
echo "$6"
echo "$7"
echo "$8"
echo "$9"
echo "$10"
echo "$11"
exit 0

When executing via a policy with slots 10 & 11 populated or not, these slots are always passed the string

/0
/1

Example results:

Running script zzz_test_parameters...
Script exit code: 0
Script result:
/
SYDIPG-VMXTEST05

4
5
6
7
8
9
/0
/1

Anyone else seen this, or can someone test on 9.5?

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Not a bug, just bash. Enclose the parameters in curly braces, like "${10} and "${11}" I've had the same problem in the past. The shell just expands the '$1' in each parameter before it sees the whole variable, so you're left with the /0 and /1 for $10 and $11 respectively.

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

Not a bug, just bash. Enclose the parameters in curly braces, like "${10} and "${11}" I've had the same problem in the past. The shell just expands the '$1' in each parameter before it sees the whole variable, so you're left with the /0 and /1 for $10 and $11 respectively.

loceee
Contributor

Yup! Of course that's what's happening. Thanks!!!!