From 4156167586e4928ff3c9fe2041036cb49c633790 Mon Sep 17 00:00:00 2001 From: Orestis Makris <57115454+OrestisMk@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:20:32 +0100 Subject: [PATCH] Create test.sh --- test.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test.sh diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..85b68ac --- /dev/null +++ b/test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Example script for shellcheck testing + +# Define a variable (shellcheck will warn about this unused variable) +name="ShellCheck Test" + +# Missing quotes around variable (shellcheck will suggest adding quotes) +echo Hello, $name + +# Useless use of cat (shellcheck will recommend avoiding cat in this way) +cat /etc/os-release | grep "NAME" + +# Using 'ls' without specifying an option, which shellcheck will flag for potential issues +for file in $(ls); do + echo "Found file: $file" +done + +# Empty if statement (shellcheck will recommend removing or adding logic) +if [ "$name" = "test" ]; then + # Do nothing +fi