-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
Hi.
I have a script with a function printing a help message using << HEREDOC syntax:
#!/usr/bin/env bash
# Use this script to test if a given URL is available
WAITFORIT_cmdname=${0##*/}
usage()
{
cat << USAGE >&2
Usage:
$WAITFORIT_cmdname -u url [-s] [-t timeout] [-- command args]
-u URL | --url=URL URL under test
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit 1
}
# rest of scriptAfter upgrading 6.2.1 -> 6.4.1 pre-commit started to show an error:
File ./docker/wait-for-curl.sh: error: indent/outdent mismatch: 1.
beautysh.formatter - ERROR: Indent/outdent mismatch: final tab level = 1
This is because this syntax is valid outside of function
cat << USAGE
...
USAGEAnd this is valid inside of function (beautysh automatically adds an indent):
usage()
{
cat << USAGE
...
USAGE
}But this is not valid:
usage()
{
cat << USAGE
...
USAGE
}./docker/wait-for-curl.sh: line 19: warning: here-document at line 8 delimited by end-of-file (wanted `EOF')
./docker/wait-for-curl.sh: line 20: syntax error: unexpected end of file from `{' command on line 7
Although it is expected by beautysh 6.4.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels