eclipse-bash-editor
eclipse-bash-editor copied to clipboard
Syntax Error - highlighting and parse of quotation marks not correct interpreted when inside execution part
#!/usr/bin/env bash string_to_asciihex() { local string="$1" local -i i eos local output=""
eos=${#string}-1
for (( i=0; i<eos; i++ )); do
output+="$(printf "%02x," "'${string:i:1}")"
done
[[ -n "$string" ]] && output+="$(printf "%02x" "'${string:eos:1}")"
tm_out "$output"
return 0
}

Hm... I had at the begining problems to understand why
output+="$(printf "%02x," "'${string:i:1}")"
is correct.
But know I think I got it...
$(...)
executes the internal parts inside brackets and there an own context is available, so
printf "%02x," "'${string:i:1}"
is interpreted by bash correct.
This will be tricky to parse, so it will take some time to implement. In the mean while you could turn off validations in preferences if it bothers you too much.
The full working example which is highlighted wrong can be found at https://github.com/drwetter/testssl.sh
Here's a different one:
- https://github.com/gradle/gradle/blob/879814d6bc0ec108aabc5afee6770ecfc073cf23/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt#L103-L105