diff options
Diffstat (limited to 'challenge-097/abigail/bash/ch-1.sh')
| -rw-r--r-- | challenge-097/abigail/bash/ch-1.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/challenge-097/abigail/bash/ch-1.sh b/challenge-097/abigail/bash/ch-1.sh new file mode 100644 index 0000000000..8e275a6519 --- /dev/null +++ b/challenge-097/abigail/bash/ch-1.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-1.sh -s SHIFT < input-file +# + +# +# Disable pathname expansion +# +set -f + +# +# Read the option +# +while getopts "s:" name +do if [ "$name" = "s" ] + then shift=$OPTARG + fi +done + + +# +# Iterate over the input, shifting each line as many times as needed +# +while read line +do for ((i = 0; i < $shift; i ++)) + do line=`echo $line | tr A-Z ZA-Y` + done + echo $line +done |
