Skip to content

Instantly share code, notes, and snippets.

@tuxlinuxien
Created June 27, 2018 13:53
Show Gist options
  • Save tuxlinuxien/0c4f8b1beffa76319236c9073f926264 to your computer and use it in GitHub Desktop.
Save tuxlinuxien/0c4f8b1beffa76319236c9073f926264 to your computer and use it in GitHub Desktop.
test1
#!/usr/bin/env bash
rm -rf file*.bin
rm -rf test_tar.tar test_my_tar.tar mytest6 test6
dd if=/dev/zero of=./file1.bin bs=1048570 count=1 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file2.bin bs=1048570 count=2 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file3.bin bs=1048570 count=3 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file4.bin bs=1048570 count=4 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file5.bin bs=1048570 count=5 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file6.bin bs=1048570 count=4 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file7.bin bs=1048570 count=7 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file8.bin bs=1048570 count=3 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file9.bin bs=1048570 count=2 2> /dev/null >> /dev/null
dd if=/dev/zero of=./file10.bin bs=1048570 count=1 2> /dev/null >> /dev/null
echo "++ test 1 ++ create archive"
tar -cf ./test_tar.tar ./file1.bin ./file2.bin ./file3.bin ./file4.bin ./file5.bin
echo "++ test 1 ++ create archive* (10)"
./my_tar -cf ./test_my_tar.tar ./file1.bin ./file2.bin ./file3.bin ./file4.bin ./file5.bin
echo "++ test 2 ++ list files"
tar -tf test_tar.tar
echo "++ test 2 ++ list files* (10)"
./my_tar -tf test_my_tar.tar
echo "++ test 3 ++ delete file (10)"
tar --delete -f test_tar.tar ./file1.bin
./my_tar -tf test_tar.tar
echo "++ test 3 ++ delete file*"
./my_tar --delete -f test_my_tar.tar ./file1.bin
./my_tar -tf test_my_tar.tar
echo "++ test 4 ++ compare"
tar -d -f test_tar.tar ./file6.bin
echo "++ test 4 ++ compare* (10)"
./my_tar -d -f test_my_tar.tar ./file6.bin
echo "++ test 5 ++ update file"
tar -u -f test_tar.tar ./file6.bin
tar -tf test_tar.tar
echo "++ test 5 ++ update file* (10)"
./my_tar -u -f test_my_tar.tar ./file6.bin
./my_tar -tf test_my_tar.tar
echo "++ test 6 ++ usage"
tar --usage
echo "++ test 6 ++ usage* (10)"
./my_tar --usage
echo "++ test 6 ++ gzip"
tar -czvf test6.tgz file7.bin file8.bin
mkdir test6
cp ./test6.tgz ./test6/test6.tgz
echo "++ test 6 ++ gzip* (20)"
./my_tar -czvf my_test6.tgz file7.bin file8.bin
mkdir mytest6
cp ./my_test6.tgz ./mytest6/my_test6.tgz
echo "++ test 7 ++ untar (gzip)"
(cd ./test6 && tar -xzvf test6.tgz)
echo "++ test 7 ++ untar (gzip)* (10)"
(cd ./mytest6 && ../my_tar -xzvf my_test6.tgz)
echo "++ test 8 ++ compare files"
md5sum ./test6/file7.bin ./mytest6/file7.bin
md5sum ./test6/file8.bin ./mytest6/file8.bin
echo "++ test 9 ++ version"
tar --version
echo "++ test 9 ++ version* (10)"
./my_tar --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment