Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- BAR=' ########## WORKING ON IT ##########'
- red=`tput setaf 1`
- green=`tput setaf 2`
- reset=`tput sgr0`
- for count in 1 2 3 4 5 6 7 8 9
- do
- export ifile$count=B_RCP4.5_CAM5_CN_NOAA2.cam.h0.20$count*
- export ofile$count=B_RCP4.5_CAM5_CN_NOAA2$count.nc
- done
- for count in 1 2 3 4 5 6 7 8 9
- do
- echo -e "\n ${red} Merging files now. Please be patient!! ${reset}\n"
- inp=ifile$count
- out=ofile$count
- rm -rf ${!out}
- rm -rf *.tmp
- while :;do
- for i in {1..37}; do
- echo -ne "${red}\e[0K\r${BAR:0:$i}${reset}";sleep 0.1; done
- done &
- trap "kill $!" EXIT #Die with parent if we die prematurely
- if (ncrcat ${!inp} ${!out}); then
- echo -e "\n ${green}=========SUCCESS!========${reset} \n"
- echo "${green}Merged these files: ${reset}"
- echo ${!inp}
- echo -e "\n${green}To this File: ${reset} \n"
- echo ${!out}
- rm -rf ${!inp}
- else
- echo -e "\n ${red}==========FAILED!==========${reset} \n"
- fi; # or any other command here
- kill $! && trap " " EXIT
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement