Advertisement
Guest User

Untitled

a guest
Apr 9th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.99 KB | None | 0 0
  1. #!/bin/bash
  2. BAR='  ########## WORKING ON IT ##########'
  3. red=`tput setaf 1`
  4. green=`tput setaf 2`
  5. reset=`tput sgr0`
  6. for count in 1 2 3 4 5 6 7 8 9
  7. do
  8. export ifile$count=B_RCP4.5_CAM5_CN_NOAA2.cam.h0.20$count*
  9. export ofile$count=B_RCP4.5_CAM5_CN_NOAA2$count.nc
  10. done
  11. for count in 1 2 3 4 5 6 7 8 9
  12. do
  13.  echo -e "\n ${red} Merging files now. Please be patient!! ${reset}\n"
  14.  inp=ifile$count
  15.  out=ofile$count
  16.  rm -rf ${!out}
  17.  rm -rf *.tmp
  18.   while :;do
  19.    for i in {1..37}; do
  20.    echo -ne "${red}\e[0K\r${BAR:0:$i}${reset}";sleep 0.1; done
  21.   done &
  22.   trap "kill $!" EXIT  #Die with parent if we die prematurely
  23.   if (ncrcat ${!inp} ${!out}); then
  24.    echo -e "\n ${green}=========SUCCESS!========${reset} \n"
  25.    echo "${green}Merged these files: ${reset}"
  26.    echo ${!inp}
  27.    echo -e "\n${green}To this File: ${reset} \n"
  28.    echo ${!out}
  29.    rm -rf ${!inp}
  30.   else
  31.    echo -e "\n ${red}==========FAILED!==========${reset} \n"
  32.   fi; # or any other command here
  33.   kill $! && trap " " EXIT
  34. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement