Convert script to strict mode
[infodrom.org/service.infodrom.org] / bin / fixsuffix
1 #! /bin/bash
2
3 # Fixes file suffix
4 #
5 # .html -> .shtml
6 #   Require "<!--#include"
7 #
8 # .php -> html
9 #   Require "<?"
10
11 for f in $*
12 do
13     if grep -q '<!--[ ]*#include' $f
14     then
15         base=${f%.php}
16         mv -f $f $base.shtml
17     else
18         if ! grep -q '<?' $f
19         then
20             base=${f%.php}
21             mv -f $f $base.html
22         fi
23     fi
24 done