Question

if 
[ -d patch/tempatch ];
then;
cd patch/tempatch/;

for i in `ls`;
do;
tar -xvf $i;
rm -f $i;
done;

for i in `ls`;
do;
cd $i;
cp -R files/* patch/SP02JUL11/files/;
cd ..;
rm -Rf $i;
done;

else;
echo "directory not found";
fi

All the commands in single line by separating with ";"

While executing it throws 0403-057 Syntax error: ; is not expected

can anyone help on this ?

Thank you

Was it helpful?

Solution

It's not specified which shell is interpereting this script... From error code I assume it's ksh...

From the error message, I presume that the problem is that after then, else, do, ksh does not accept a ;.

However, just out of curiosity, I did just install ksh on my linux box. It's at version "93u+ 2012-08-01". Your script runs just fine, no syntax errors, here... Probably you are running a different (possibly older) version of the shell, or a different shell at all... You should definitely specify which shell you're using... :-).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top