Hello,

I'm all new to the world of shell scripting so please excuse my ignorance here.

The script below was originaly created on a HPUX system and has now been moved across to a Red Hat linux system. Everytime I run this script I get the following error:-

line 2: read: 4: invalid file descriptor: Bad file descriptor

Can you please point me in the right direction as to what needs changing to resolve my problem.

Thanks

Code:
exec 4<$1
while read -u4 next_rec; do
 echo $next_rec|awk -F "|" '{print $7}'|read expiry

if [ "$expiry" = "00000000" ]
 then
  echo $next_rec|awk -F "|" '{print $1"|"$2"|"$3"|"$4"|"$5"|"$6"|03312008|"$8"|"$9"|"$10"|"$11"|"$12"|"}' >> new.dat
  else
   echo $next_rec >> new.dat
fi
done