Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -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