beautysh: I cannot beautify my code

It throw this error out, but i’m not sure what it mean??

File src/core/download_resource_management: error: indent/outdent mismatch: 2.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 21 (6 by maintainers)

Most upvoted comments

The current master branch exhibits the reported behavior on the code submitted by kamontat on October 18. Commit 9e98979087f0923ae222770d80fb25728c6914c2 doesn’t fix it. Here’s a smaller example that exhibits the same behavior:

#!/bin/bash

function get_resource {
    IFS="$DELIMITER" read -r -a ARR <<< "$temp"
}

The problem is indeed the <<< here-string syntax. Beautysh mostly assumes that any appearance of << indicates a here document, which is false. The above commit changed beautysh to exclude a very specific use of here strings (i.e., the ones at the ends of while loops), but doesn’t address broader use of here strings. (Several examples available in the Advanced Bash-Scripting Guide on the topic.)