Considering that feh doesn't write to STDOUT when putting an image on the root window, why are you capturing its output, and printing it? Why not just use system?
Too bad feh -z -bg-center ~/Pictures/rotate/*.jpg doesn't just do the right thing (-z to randomize the list, then have -bg-center display the first one).