Rewrite in shell script