Handle fragment logic in bash properly.