Changed $() to `` and $() to expr for sh compatibility -- geraint