diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-01-04 21:18:09 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-04 21:18:09 +0000 |
| commit | d1581f755d50e5b3a5ccf74a25280f39caa809fc (patch) | |
| tree | 14d50cbd3a19dddf06cb89f16ea57155024e1da6 /challenge-146/abigail/bash | |
| parent | d8abd054e8e70147188d2b57c922ba092e2aecff (diff) | |
| parent | 41c3d16c97874e85d25f28d37e59df3e2d9a9d66 (diff) | |
| download | perlweeklychallenge-club-d1581f755d50e5b3a5ccf74a25280f39caa809fc.tar.gz perlweeklychallenge-club-d1581f755d50e5b3a5ccf74a25280f39caa809fc.tar.bz2 perlweeklychallenge-club-d1581f755d50e5b3a5ccf74a25280f39caa809fc.zip | |
Merge pull request #5463 from Abigail/abigail/week-146
Week 146
Diffstat (limited to 'challenge-146/abigail/bash')
| -rw-r--r-- | challenge-146/abigail/bash/ch-1.sh | 11 | ||||
| -rw-r--r-- | challenge-146/abigail/bash/ch-2.sh | 27 |
2 files changed, 38 insertions, 0 deletions
diff --git a/challenge-146/abigail/bash/ch-1.sh b/challenge-146/abigail/bash/ch-1.sh new file mode 100644 index 0000000000..64ba3a2d29 --- /dev/null +++ b/challenge-146/abigail/bash/ch-1.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-1.sh +# + +echo "104743"
\ No newline at end of file diff --git a/challenge-146/abigail/bash/ch-2.sh b/challenge-146/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..5a5ee147f5 --- /dev/null +++ b/challenge-146/abigail/bash/ch-2.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-2.sh < input-file +# + +set -f + +IFS=/ + +while read a b +do for ((i = 1; i <= 2; i ++)) + do if ((a < b)) + then ((b -= a)) + else ((a -= b)) + fi + if ((a == 0 || b == 0)) + then break + fi + printf "$a/$b " + done + echo +done |
