i have made an script to compress 3 files in zip and tar and measure the time to make a comparison, but when i try to redirect the output of time to a file the output stored in it is the tar and zip ones, could someone help me?
#!/bin/bash
if [ "$#" != 3 ]
then
echo "usage $0 file1 file2 file3"
exit
fi
echo "Start\n"
echo "First zip:" > time.txt
time >> time.txt zip -r $1.zip $1
echo "first zip done"
echo "first tar:" >> time.txt
time >> time.txt tar czf $1.tar.gz $1
echo "first tar done"
echo "second zip:" >> time.txt
time >> time.txt zip -r $2.zip $2
echo "Second zip done"
echo "second tar:" >> time.txt
time >> time.txt tar cfz $2.tar.gz $2
echo "Second tar done"
echo "third zip:" >> time.txt
time >> time.txt zip -r $3.zip $3
echo "third zip done"
echo "third tar:" >> time.txt
time >> time.txt tar cfz $3.tar.gz $3
echo "third tar done"
rm *.zip *.tar.gz
exit
Thanks