Hi.
Can some one please tell me what I am doing wrong, It's probably so
stupid, but I can't see it. I need to read in some parameters from a
single line in a file based on an input parameter. A simple test file
amd associated parameter file is given below. When I run this I for
portugal I get:
$ ./test.sh Pt
Pt Portugal Lisbon Portugese
End
What I would really like to se is;
$ ./test.sh Pt
Pt Portugal Lisbon Portugese
End Pt Portugal Lisbon Portugese
Why are the parameters set inside the loop but not outside, yes It's a
matter of scope but how do I make them available beyond the "done" line?
Any help would be appreciated.
Rob.B
Parameter File test.parm
El Greece Athens Greek
Es Spain Madrid Spanish
Fr France Paris French
Pt Portugal Lisbon Portugese
En England London English
Ie Ireland Dublin Gaelic
Nl Netherlands Amsterdam Dutch
Script test.sh
#! /bin/sh
cat ${0%.*}.parm |
while read CCODE COUNTRY CAPITAL LANG
do
if [ ${1} = ${CCODE} ]
then
echo $CCODE $COUNTRY $CAPITAL $LANG
break
fi
done
echo "End" $CCODE $COUNTRY $CAPITAL $LANG
--