[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: P05 Test



> ... I used fortune with rev to test so you get a reversed fortune.

fortune and rev is pretty cool, almost looks like encryption:

 $ ./pipe fortune rev
 :dehsinif si htrae no noissim ruoy rehtehw dnif ot tset a si ereH
 .t'nsi ti ,evila er'uoy fi
 $

Another possibility for the 2nd child is tac, which is like a backwards cat, it prints the
lines in reverse order.  Only interesting if there is more than one line of output:

 $ ./pipe fortune tac
 means that only left handed people are in their right mind.
 The right half of the brain controls the left half of the body.  This
 $

How about combining rev and tac with some additional shell pipelines:

 $ fortune | ./pipe rev tac
 .esrevinU eht fo egdE eht ta tnaruatseR ehT --
 .gnivil eht no detsaw si efiL
 $ fortune | ./pipe rev tac | ./pipe rev tac
 Research is what I'm doing when I don't know what I'm doing.
                 -- Wernher von Braun
 $

pipe rev tac can be undone using another pipe rev tac or pipe tac rev.