shelllings

a practical way to learn shell
git clone https://git.davidvoz.net/shelllings.git
index
logs
tree
license

commit d3d5de8a2fff6e399cfc6eb52dcfbda4910b504e
Author: David Voznyarskiy <31452046-davidvoz@users.noreply.gitlab.com>
Date:   Fri Jan 2 23:40:13 2026 -0800

    exercise 29 gzip added

diff --git a/exercises/29_gzip.sh b/exercises/29_gzip.sh
new file mode 100644
index 0000000..919a4c1
--- /dev/null
+++ b/exercises/29_gzip.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# gzip (gunzip) is a GNU file compression and expansion tool that comes
+# with most linux distrobutions. Use the --help option to know how to
+# compress the LICENSE file into a new file LICENSE.gz, leaving LICENSE
+# unchanged. If successful, don't worry about having to remove the .gz
+# file, shelllings.sh will take care of that.
+
+
diff --git a/tests/29_gzip.sh b/tests/29_gzip.sh new file mode 100644 index 0000000..1748af7
--- /dev/null
+++ b/tests/29_gzip.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -eu
+RED="\033[31m"
+GREEN="\033[32m"
+RESET="\033[0m"
+
+cleanup() {
+ [ -f "LICENSE.gz" ] && rm LICENSE.gz
+}
+trap cleanup EXIT
+
+failed() {
+ printf "${RED}Failed${RESET}\n"
+ exit 1
+}
+
+sh exercises/29_gzip.sh || failed
+
+[ -s LICENSE.gz ] || failed
+[ -s LICENSE ] || failed
+
+leis_size=$(stat -c%s LICENSE)
+gz_size=$(stat -c%s LICENSE.gz)
+
+[ $leis_size -gt $gz_size ] || failed
+
+printf "${GREEN}Passed${RESET}\n"