Some quoting added and bashism removed.