solutions for 7th problem with bash version