Skip to content
Closed
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
7 changes: 7 additions & 0 deletions hello-ocr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# throwaway file to smoke-test OpenCodeReview (safe to delete)
greet() {
Comment on lines +1 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing set -euo pipefail at the top of the script. Without it, the script will continue executing after errors (no set -e), use of unset variables won't be caught (no set -u), and errors in pipelines may be silently ignored (no set -o pipefail). This makes the script fragile and harder to debug.

Suggestion:

Suggested change
#!/bin/bash
# throwaway file to smoke-test OpenCodeReview (safe to delete)
greet() {
#!/bin/bash
set -euo pipefail
# throwaway file to smoke-test OpenCodeReview (safe to delete)
greet() {

name=$1
echo Hello $name
}
greet $USER
Comment on lines +5 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable expansions $name and $USER are not quoted. Unquoted variables are subject to word splitting and globbing, which can cause unexpected behavior or errors if the values contain spaces or special characters. Always quote variable expansions.

Suggestion:

Suggested change
echo Hello $name
}
greet $USER
echo "Hello $name"
}
greet "$USER"