ksh script to perform an upgrade Could you please review my script?

#!/bin/ksh
T=/bb/bdap/bin/cms/tools
U=$T/upgrader
mv $T/conbase_updates $U/conbase_updates.br.drqs$1
cd $U
grep "^BR" config.alpha &gt; config.br
./ConbaseUpgrader config.br conbase_updates.br.drqs$1
You might want to validate the value of $1, or at least that it's not empty, for example add a line like this near the top:

test "$1" || { echo usage: $0 param; exit 1; }




You are not checking for errors, for example what will happen if the mv command fails for whatever reason? Maybe you have no reason to suspect a problem there, but just in case it would be good to add the -e flag to the shebang (#!/bin/ksh) so that execution will stop immediately there. Otherwise execution would continue after the failed mv, and the grep ... &gt; ... might clobber a file by accident.

In any case, adding the -e flag in the shebang is a good practice in general.



It seems your variables will not normally contain spaces. If they ever do, remember to quote them properly, for example:

mv "$T/conbase_updates" "$U/conbase_updates.br.drqs$1"


(in your current example it's unnecessary)