Alternate approach to trimming string in bash