All pastes #769926 Raw Edit

Unbenannt

public shellscript v1 · immutable
·published 2007-11-11 19:35 UTC
rendered paste body
if [ -z $1 ]then	echo "No Parameter given, Aborting..."	exitfiif [ -z $2 ]then	echo "No Destination given, Aborting..."	exitfiif [ ! -f $1 ]then	echo "Souce File \"$1\" does not exist, Aborting..."	exitfiif [ ! -d $2 ]then	echo "Destination Folder \"$2\" does not exist, Aborting..."	exitfiif [ $2 = "." ]then	dir=`pwd`elsedir=$2fi	echo "Starting to move $1 to $dir"size1=`du $1 -b | cut -f1`size2="0"i="0"percent=`echo "($size2 / $size1)*100" | bc -l | cut -c -5`mv $1 $dir/$1 &sleep 0.5while [ ! "$size1" = "$size2" ]do	i=`expr $i + 1`		size2=`du $dir/$1 -b | cut -f1`	percent=`echo "($size2 / $size1)*100" | bc -l | cut -c -5`	if [ `echo "$percent < 10" | bc` = 1 ]	then		percent=`echo 0$percent | cut -c -5`	fi	if [ `echo "$i > 1" | bc` = 1 ]	then		echo -n -e "\b\b\b\b\b\b$percent%"	else		echo -n "Done: $percent%"	fi	sleep 0.5doneecho ""