diff options
| author | Abigail <abigail@abigail.be> | 2021-01-26 02:09:46 +0100 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-01-26 12:07:41 +0100 |
| commit | cc68e1c2ea0d685072b4063aeb9af50f7e42cd98 (patch) | |
| tree | dd319e35d9b446d05f0cda0879c6bba74bbb7cb8 /challenge-097/abigail/bash | |
| parent | 2ff2fcdc51c6bad5b0bd61f645226e7838c26579 (diff) | |
| download | perlweeklychallenge-club-cc68e1c2ea0d685072b4063aeb9af50f7e42cd98.tar.gz perlweeklychallenge-club-cc68e1c2ea0d685072b4063aeb9af50f7e42cd98.tar.bz2 perlweeklychallenge-club-cc68e1c2ea0d685072b4063aeb9af50f7e42cd98.zip | |
Bash solution for week 097, part 2
Diffstat (limited to 'challenge-097/abigail/bash')
| -rw-r--r-- | challenge-097/abigail/bash/ch-1.sh | 29 |
1 files changed, 29 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..e51ebe5562 --- /dev/null +++ b/challenge-097/abigail/bash/ch-1.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-1.sh -s SHIFT < input-file +# + +# +# 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 |
