Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!seismo!umcp-cs!cvl!umd5!zben From: zben@umd5.UUCP (Ben Cranston) Newsgroups: net.unix Subject: Variations across unices Message-ID: <1037@umd5.UUCP> Date: Wed, 18-Jun-86 16:32:26 EDT Article-I.D.: umd5.1037 Posted: Wed Jun 18 16:32:26 1986 Date-Received: Sat, 21-Jun-86 09:34:12 EDT Distribution: net Organization: U of Md, CSC, College Park, Md Lines: 33 About a week ago the following shell script was posted to net.jokes: > # encrypt/decrypt a rot13 file > # usage: rot13 file or command | rot13 > eval tr '"[A-Z][a-z]" "[N-Z][A-M][n-z][a-m]"' ${1:+'<$1'} ^ What good is this colon? We were speculating that it might serve to terminate a numeric expression a la ${foo+bar-1:+defalt} but were not able to get this shell script to work until the colon be removed. We also had to remove the [square brackets] for it seems that "tr" on this system not only doesn't need them but treats them as normal characters! On this (BSD) system the following two scripts do seem to work: #! /bin/sh # encrypt/decrypt a rot13 file # usage: rot13 file or command | rot13 eval tr '"A-Za-z" "N-ZA-Mn-za-m"' ${1+'<$1'} #! /bin/sh # encrypt/decrypt a rot13 file # usage: rot13 file or command | rot13 echo tr 'A-Za-z N-ZA-Mn-za-m' ${1+'<$1'} Are there in fact variant unices that require the [square brackets] on "tr" commands and allow integer expressions in ${parm+defalt} lists? Or is this just somebody's idea of a bad joke? -- umd2.UMD.EDU Kingdom of Maryland Sperrows 1100/92 Ben Cranston zben @ umd5.UUCP {seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben umd2.BITNET