Shell scripting newbie - please be gentle.

Hello Gurus,
Here's my problem, I have log files that are created automatically once a day by a feature of NetBackup called Vault. I usually move these files manually to a different location so I can FTP them later, however I know that this can be automated and so here's the info:

When vault runs it updates a file called session.last in this file there's nothing more than a number (1, 2, 3, 4 etc) and that number can reach double digits. The current number in this file is directly associated to the last directory that's created for the Vault session. Meaning that if the file has the number 5 in it, the newest vault directory will be sid5, and in this directory are the files I need to move.

My question is, in a script using an if statement or any other way for that matter, how do I cat or grep the current number in this file and append it to the newest vault directory, so that my cp command can understand where to look?

Here's what I had managed to device so far and this is really amateur scripting so have a laugh if you must, :rolleyes:

dir=/opt/openv/netbackup/vault/sessions/server_vault/
_2dir=/home/admin/Vault/
fname=/opt/openv/netbackup/vault/sessions/catalina_vault/session.last
#
if [ -f "fname" ]; then
cat $fname | read NUMBER
if [ $NUMBER -lt 100 ] ; then
echo "file exists and will be moved" ;
cp $dir/sid$NUMBER/picklist* > $_2dir/
end
fi
fi

I'm pretty sure the read command isn't doing me any good, this is version 17 of a horrible script to do something simple, any help on this I would really appreciate it.

Thank you all.

Charlie.

dir=/opt/openv/netbackup/vault/sessions/server_vault
_2dir=/home/admin/Vault
fname=/opt/openv/netbackup/vault/sessions/catalina_vault/session.last
#
if [ -s "$fname" ]
then
   NUMBER=`cat $fname`
   if [ "$NUMBER" -lt 100 ]
   then
      echo "File exists and will be moved."
      mv ${dir}/sid${NUMBER}/picklist* ${_2dir}
   else
      echo "Sequence number is greater than 99, nothing to do."
   fi
else
   echo "File $fname does not exist or is empty!"
fi

Thanks a lot robotronic, that worked like a charm.