rot13 and rot47 shell functions
blarbaltest - 3 years ago (last modified 3 years ago)
function rot13() { if [ -r $1 ]; then cat $1 | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'; else echo $* | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'; fi }
function rot47() { if [ -r $1 ]; then cat $1 | tr '\!-~' 'P-~\!-O' ; else echo $* | tr '\!-~' 'P-~\!-O'; fi }
# usages: # rot13 test # echo test | rot13
Any chance there could be a link somewhere with a "Formatting Help" or FAQ that covers formatting?
replyYou can format with monospace by prepending two spaces, e.g.
' test'
becomes
Thankyou!
replyI've edited it for you, I hope you don't mind.
EDIT: And I've found I strip a bit too much whitespace. Whoops
reply