Caesar Shifting
Pyth, 13 bytes
uXGH.<HQrBG1z
Basically, we start with the two strings we want to caesar shift, the lowercase and uppercase alphabets. The list containing both of these is generated by rBG1
, bifurcate on uppercase. Then, we reduce over this list, starting with the input string and translating first lowercase, then uppercase letters by the appropriate shift.
Pyth, 16
XXzG.<GQJrG1.<JQ
Try it online or run a Test Suite
Bash + bsd-games package, 21
caesar $[($1+130)%26]
Builtins FTW! Almost feels like Mathematica. Pyth answers are still shorter though.
Input string read from STDIN and integer from command-line. e.g.:
$ ./caesar.sh 13 <<< "Spam spam spam sausage and spam!"
Fcnz fcnz fcnz fnhfntr naq fcnz!
$
Or if you don't like the builtin:
Bash + coreutils, 63
printf -va %s {a..z}
t=${a:$1%26}${a:0:$1%26}
tr A-Z$a ${t^^}$t