do both rewrite methods in bash script