Find all files in the current directory (and its subdirectories) whose name ends with ".sh", and for each of those files, run the command "sed -i -e 's/\s\+$//'" to remove any trailing whitespace.
find ./ -name ".sh" | xargs sed -i -e 's/\s\+$//'