#!/bin/bash
#
# bznull.sh:
# with this script you can compress the VOID into a file of N gb.
# It first compresses the file `null' using bzip2, then it compresses the .bz2
# file using gzip, then using rar, finally using zip.
# The whole process is reiterated `N+1'# times.
#
# Launch this script as follow in a temporary directory:
#  mkdir temp_dir
#  cp bznull.sh temp_dir/
#  cd temp_dir/
#  ./bznull.sh 5 > /dev/null
# 
# If the first argument to bznull.sh is `N', the number of iteration.
#
# --
# Bznull.sh was inspired by Arfalas
#
#							 AlpT (@freaknet.org)

if [ -z "$1" ]
then 
	echo Specify the number of reiterations
	exit 1
fi

REI="$1"

touch null
rm -f null.tar.bz2
tar cfj null.tar.bz2 null
rm -f null.tar.gz
tar cfz null.tar.gz  null.tar.bz2
rm -f null.rar
rar a null.rar null.tar.bz2
rm -f null.zip
zip null.zip null.rar

for((i=0; i<$REI; i++))
do
	rm -f null.tar.bz2
	tar cfj null.tar.bz2 null.zip
	rm -f null.tar.gz
	tar cfz null.tar.gz  null.tar.bz2
	rm -f null.rar
	rar a null.rar null.tar.bz2
	rm -f null.zip
	zip null.zip null.rar
done
rm -f null.tar.bz2
tar cfj null.tar.bz2 null.zip

rm null null.rar null.zip null.tar.gz
