Skip to content

Commit

Permalink
Update functions.bash to conform to SC1117.
Browse files Browse the repository at this point in the history
Escape backslashes to explitly pass them as literal backslashes.

ShellCheck SC1117
https://github.com/koalaman/shellcheck/wiki/SC1117
  • Loading branch information
xwmx committed Apr 13, 2018
1 parent 092057c commit 483c2c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ HEREDOC
return 0
fi

printf "Hello.\n"
printf "Hello.\\n"
}

###############################################################################
Expand Down Expand Up @@ -69,9 +69,9 @@ Description:
HEREDOC
elif [ "${1}" = "--all" ]
then
printf "Hi, everyone\!\n"
printf "Hi, everyone!\\n"
else
printf "Hi\!\n"
printf "Hi!\\n"
fi
}

Expand Down
6 changes: 3 additions & 3 deletions test/functions.bats
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ HEREDOC

@test "\`hi\` with no arguments prints a string." {
run hi
[[ "${output}" == "Hi\!" ]]
[[ "${output}" == "Hi!" ]]
}

@test "\`hi -h\` returns status 0." {
Expand Down Expand Up @@ -112,6 +112,6 @@ HEREDOC

@test "\`hi --all\` prints a string." {
run hi --all
_compare "Hi, everyone\!" "${output}"
[[ "${output}" == "Hi, everyone\!" ]]
_compare "Hi, everyone!" "${output}"
[[ "${output}" == "Hi, everyone!" ]]
}

0 comments on commit 483c2c2

Please sign in to comment.