Skip to content

Commit

Permalink
Fix shellchecker header script to consider multiple lines
Browse files Browse the repository at this point in the history
The shellcheck directive can appear after the shebang line, but the
script was only considering the first line.
  • Loading branch information
marcospereira committed Jan 11, 2021
1 parent bf6860a commit 8464570
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hooks/dot-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ for file in "$@"; do

# Confirm expected schellcheck header
#
LINE1="$(head -n 1 "${file}")"
if [[ "${LINE1}" != "# shellcheck shell=bash" ]]; then
HEADER="$(head -n 2 "${file}")"
if [[ "${HEADER}" != *"# shellcheck shell=bash"* ]]; then
echo "Bash include file \`${file}\` has bad/missing shellcheck header"
exit_code=1
fi
Expand Down
1 change: 1 addition & 0 deletions themes/base.theme.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck shell=bash

CLOCK_CHAR_THEME_PROMPT_PREFIX=''
CLOCK_CHAR_THEME_PROMPT_SUFFIX=''
Expand Down

0 comments on commit 8464570

Please sign in to comment.