Shell script problem - TechRepublic
General discussion
March 21, 2001 at 06:09 AM
it1

Shell script problem

by it1 . Updated 24 years, 11 months ago

I’m new to shell scripting, but have managed to get a couple of scripts written that will automatically ftp inbound files from external clients to our HP3000 for processing. I have a Sun Ultra 10 w/Solaris 8 OS. I now have a couple clients that sendin files in a date type format with a .txt or .k or .cu extensions. For example: 03202001.k or mar2001.txt. When the files come in they are given a batch id and I just use the variable for that, $batchid. (which is just the name of the file). However, our HP does not handle extensions and what I need to do is rename them. And because each client sends in multiple files I need to distinguish between them. Basically, I am scripting so that they get forwarded to a temp file and then ftp to our HP3000 from there (I have different scripts for each file that comes in). My if statements looks something like this:
if [ $batchid = *.[Tt][Xx][Tt] ]
then
….
elif [ $batchid = *.[Kk] ]
then
…..
fi
fi
Again, the batchid is the variable for the file coming in to the system. My conditional staements aren’t executing and I was wondering if someone knew where I was losing it? Thanks

This discussion is locked

All Comments