Bash script for retention(DIRTY)