Below is a simple script to find out whether all files exists and are having size greater than zero or not. From here I know '-s' is used for the task.
if [ -s ${file1} && -s ${file2} && -s ${file3}]; then
echo "present"
echo "Perform analysis"
else
echo "not present";
echo "Value of file1: `-s ${file1}`"
echo "Value of file2: `-s ${file2}`"
echo "Value of file3: `-s ${file3}`"
echo "skip";
fi
The files are present on the path same as the script. I have checked the files names and it is correct. I am getting the following error :
./temp.ksh[]: [-s: not found [No such file or directory]
not present
./temp.ksh[]: -s: not found [No such file or directory]
Value of file1:
./temp.ksh[]: -s: not found [No such file or directory]
Value of file2:
./temp.ksh[]: -s: not found [No such file or directory]
Value of file3:
I can't seem to find out what's wrong with above. Is this specific to KornShell? I can only use KSH.