eldoctor
May 6th, 2008, 12:28 AM
Hi everyone I have a bit of a problem here, is driving me mad. The code is the following:
while read LINEA; do
strstr $LINEA $USER
if [ $? -eq 1 ]; then
(( P += 1 ))
PERIODICOS[P]=${LINEA%%:*}
fi
done < /etc/michelle/modulos/modulosperiodicos.cfg
J=1
while [ $J -le $P ]; do
export ${PERIODICOS[J]}
(( J += 1))
done
Each line in the "modulosperiodicos.cfg" is as follows:
/etc/michelle/modulos/limitaciones/limitaciones.sh:guest:guest2
A path to a script, after the ":" come the users but it does not matter because they are cut out, so each array position is assigned a line like this one:
/etc/michelle/modulos/limitaciones/limitaciones.sh
The problem comes when I try to export the array, I keep getting this error message:
/usr/bin/michelle.sh: line 154: export: `/etc/michelle/modulos/loadControl/loadControl.sh': not a valid identifier
I did this kind of "array exportation" in another script of my program and it worked fine with the only difference that the contents of the other array where not paths.
So my question is... how can I get this to work?? how can I export this array??
Thanks!!
while read LINEA; do
strstr $LINEA $USER
if [ $? -eq 1 ]; then
(( P += 1 ))
PERIODICOS[P]=${LINEA%%:*}
fi
done < /etc/michelle/modulos/modulosperiodicos.cfg
J=1
while [ $J -le $P ]; do
export ${PERIODICOS[J]}
(( J += 1))
done
Each line in the "modulosperiodicos.cfg" is as follows:
/etc/michelle/modulos/limitaciones/limitaciones.sh:guest:guest2
A path to a script, after the ":" come the users but it does not matter because they are cut out, so each array position is assigned a line like this one:
/etc/michelle/modulos/limitaciones/limitaciones.sh
The problem comes when I try to export the array, I keep getting this error message:
/usr/bin/michelle.sh: line 154: export: `/etc/michelle/modulos/loadControl/loadControl.sh': not a valid identifier
I did this kind of "array exportation" in another script of my program and it worked fine with the only difference that the contents of the other array where not paths.
So my question is... how can I get this to work?? how can I export this array??
Thanks!!