File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # This script contains intentional bash syntax errors for testing the linter
4+
5+ # # Error 1: Missing 'then' in if statement
6+ # if [ "$1" == "test" ]
7+ # echo "This will cause an error"
8+ # fi
9+
10+ # Error 2: Unmatched quotes
11+ echo " This quote is not closed
12+
13+ # Error 3: Missing 'do' in for loop
14+ for file in *.txt
15+ echo $file
16+ done
17+
18+ # Error 4: Unclosed function
19+ function test_function() {
20+ echo " This function is not closed properly"
21+
22+ # Error 5: Invalid variable assignment (space around =)
23+ my var = " invalid"
24+
25+ # Error 6: Missing closing bracket
26+ if [ " $USER " == " root" ; then
27+ echo " Root user detected"
28+ # fi is commented out
29+
30+ # Error 7: Invalid command substitution
31+ result = ` ls | grep " *.txt"
32+
33+ # Error 8: Mismatched parentheses
34+ if (( $# > 0 ]; then
35+ echo "Arguments provided"
36+ fi
37+
38+ # Error 9 : Invalid redirection
39+ echo "test" > > output.txt
40+
41+ # Error 10 : Unclosed here document
42+ cat << EOF
43+ This is a here document
44+ that is never closed
45+
46+ echo "This line will cause issues"
You can’t perform that action at this time.
0 commit comments