changed echo -n to printf (preferred for portability)