diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2021-01-28 00:40:53 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-28 00:40:53 +0000 |
| commit | 31e71edbc488c401e26fd11d802f3145f6eee8fa (patch) | |
| tree | 8a7ed84804d12606f4e08790e4a657018c552ba1 /challenge-097/abigail/bash/ch-1.sh | |
| parent | dbd5acc0043f19ac068a9c9a7737ed7a2a1a9cba (diff) | |
| parent | 978ad5065e463bf52cd11ea13c1a2c1519a2c07b (diff) | |
| download | perlweeklychallenge-club-31e71edbc488c401e26fd11d802f3145f6eee8fa.tar.gz perlweeklychallenge-club-31e71edbc488c401e26fd11d802f3145f6eee8fa.tar.bz2 perlweeklychallenge-club-31e71edbc488c401e26fd11d802f3145f6eee8fa.zip | |
Merge branch 'master' into 003
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 |
