[Nottingham] Shell programming

Simon Huggins huggie at earth.li
Sat Dec 18 15:50:23 GMT 2004


On Sat, Dec 18, 2004 at 03:36:52PM +0000, Martin wrote:
> Martin wrote:
> [...]
> >function rot13
> >{
> >        echo $@ | sed 
> >        y/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM/
> >}
> >export -f rot13
> [...]
> I left /that/ uglyness in there some drunken night?!!!
> A little contest for the bashers: What's the shortest bash rot13 function?

Replace the sed with just: tr [a-zA-Z] [n-za-mN-ZA-M]
perhaps?

Simon.

-- 
        Black Cat Networks        -(   "Haven't you ever seen a dragon   )-
UK domain, email and web hosting  -(   being arrested before?" - Capt    )-
http://www.blackcatnetworks.co.uk -(                Vimes                )-



More information about the Nottingham mailing list