test: OCR munmiu bot#8
Closed
vanducng wants to merge 1 commit into
Closed
Conversation
| @@ -0,0 +1,6 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
The script lacks set -euo pipefail, which is a best practice for bash scripts. Without it, the script will continue executing even if a command fails or an unset variable is referenced, which can lead to silent errors and unpredictable behavior.
-e: Exit immediately if a command exits with non-zero status.-u: Treat unset variables as an error.-o pipefail: Return the exit status of the last command in a pipeline that failed.
Suggestion:
Suggested change
| #!/bin/bash | |
| #!/bin/bash | |
| set -euo pipefail |
Comment on lines
+4
to
+6
| echo Hello $name | ||
| } | ||
| greet $USER |
There was a problem hiding this comment.
Variable expansions $name and $USER are not quoted. Unquoted variables are subject to word splitting and glob expansion by the shell. For example, if $name contained spaces or special characters, the output would be incorrect or cause unexpected behavior. Always quote variable expansions to handle values with spaces or special characters safely.
Suggestion:
Suggested change
| echo Hello $name | |
| } | |
| greet $USER | |
| echo "Hello $name" | |
| } | |
| greet "$USER" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Throwaway.