From 7223b44e158a37deaba6e964c9f35c8ae3c83bd5 Mon Sep 17 00:00:00 2001
From: Jan Frenzel <jan.frenzel@tu-dresden.de>
Date: Wed, 24 Aug 2022 14:10:09 +0200
Subject: [PATCH] Removed two unnecessary uses of cat in check-code-style.sh.

---
 doc.zih.tu-dresden.de/util/check-code-style.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/doc.zih.tu-dresden.de/util/check-code-style.sh b/doc.zih.tu-dresden.de/util/check-code-style.sh
index 1f0cfac7a..995354740 100755
--- a/doc.zih.tu-dresden.de/util/check-code-style.sh
+++ b/doc.zih.tu-dresden.de/util/check-code-style.sh
@@ -60,13 +60,10 @@ function style_check() {
   elif [[ "${ext}" == "md" ]]; then
     # If markdown file is provided
     # Check if the code snippet exists in the markdown file
-    local test_string_exit_code
-    test_string_exit_code=$(cat $myfile | sed -n '/^```bash$/,/^```$/p' | grep -qv '```'; echo $? | tail -1)
-
-    if [[ "${test_string_exit_code}" == "0" ]]; then
+    if sed -n '/^```bash$/,/^```$/p' $myfile | grep -qv '```'; then
       # Extracting code snippet within ```bash ... ```
       local test_string
-      test_string=$(cat $myfile | sed -n '/^```bash$/,/^```$/p' | grep -v '```')
+      test_string=$(sed -n '/^```bash$/,/^```$/p' $myfile | grep -v '```')
 
       # Check the exit code of pattern match
       if echo "${test_string}" | grep -qP "${pattern}"; then
-- 
GitLab