add script header and cosmetics
ksh compatibility