Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- ## Functions
- format_time(){
- # deltatime=$1
- minutes=$(echo "$1/60" | bc)
- seconds=$(echo "$1%60" | bc)
- ftime="$minutes:$seconds"
- }
- #
- print_status_process(){
- if [ ! "$step" -eq "0" ]; then
- local timenow=$(date -u +"%s")
- local perc=$(echo "scale=4;$step/$total*100" | bc)
- local ftime=""
- local deltatime=$(echo "$timenow-$timeini" | bc)
- local lefttime=$(echo "scale=4;($deltatime/$step)*($total-$step)" | bc)
- format_time $deltatime
- local fdeltatime=$ftime
- format_time $lefttime
- local flefttime=$ftime
- printf "\r%-100s" "$step/$total($perc %) - times(minutes:seconds): $fdeltatime(elapsed) $flefttime(left)"
- fi
- }
- #
- ## Process variable
- shp="catalog_inpe_cbers4.shp"
- title="Append Geojson's in '"$shp"'"
- lst="LIST_OF_IMAGES"
- ##
- dateini=$(date +"%Y%m%d %H:%M:%S")
- echo
- echo $title" - Started "$dateini
- #
- total=$(cat $lst | wc -l)
- step='0'
- timeini=$(date -u +"%s")
- for item in $(cat $lst)
- do
- print_status_process
- #
- footprint_append_shp.sh $item $shp >/dev/null
- #
- step=$(echo "$step+1" | bc)
- done
- #
- dateend=$(date +"%Y%m%d %H:%M:%S")
- echo
- echo "Finished "$dateend
Advertisement
Add Comment
Please, Sign In to add comment