aboutsummaryrefslogtreecommitdiff
path: root/challenge-097/abigail/bash/ch-1.sh
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2021-01-28 00:40:53 +0000
committerGitHub <noreply@github.com>2021-01-28 00:40:53 +0000
commit31e71edbc488c401e26fd11d802f3145f6eee8fa (patch)
tree8a7ed84804d12606f4e08790e4a657018c552ba1 /challenge-097/abigail/bash/ch-1.sh
parentdbd5acc0043f19ac068a9c9a7737ed7a2a1a9cba (diff)
parent978ad5065e463bf52cd11ea13c1a2c1519a2c07b (diff)
downloadperlweeklychallenge-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.sh34
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