rewrite in sh