Bash Parameter Expansion

#!/bin/bash
SNMPW='/usr/bin/snmpwalk'
while read h i
do
loc=$($SNMPW -v3 -u 'Myusername' -l authPriv -a SHA -A 'Password1' -x AES -X 'Password2' $i sysLocation.0 2>/dev/null)
loc=${loc:-" is not snmpable."}
loc=${loc##*: }
loc=${loc//,/}
echo "$i,$h,$loc"
done < $1

My question is ...

Is there a way to nest the 3 parameter expansion statements for the var $loc ?

I'm afraid - no. That's a feature of bash - I can't talk for other shells.

1 Like