pipe function finished ( with small bug for 1st cmd )