fix infinite loop on commands

The array was not being shifted for all cases. This lead to the command
succeeding, but being retried anyway.

checked with
function psm { ps auxwwe | grep mesos | grep -v 'ps auxwwe' | grep -v 'grep mesos'; }
function test { 
 echo start the test, any running?;
 psm;
 echo switch them on, any there now?;
 chkconfig mesos-slave --level 345 on;
 chkconfig mesos-master --level 345 on;
 telinit 3;
 sleep 3;
 psm;
 echo there should be...
 echo switch them off;
 chkconfig mesos-slave --level 345 off;
 chkconfig mesos-master --level 345 off;
 telinit 3;
 sleep 3;
 echo any left?
 psm;
 echo finished
 }
test

Pre-fix, there will be some extra /etc/init.d/ scripts running in a loop.