eclipse-bash-editor icon indicating copy to clipboard operation
eclipse-bash-editor copied to clipboard

Syntax Error - highlighting and parse of quotation marks not correct interpreted when inside execution part

Open robert-greene opened this issue 4 years ago • 3 comments

#!/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

}

robert-greene avatar Sep 20 '20 21:09 robert-greene

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.

de-jcup avatar Feb 20 '21 00:02 de-jcup

The full working example which is highlighted wrong can be found at https://github.com/drwetter/testssl.sh

de-jcup avatar Feb 20 '21 00:02 de-jcup

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

gradlew

stanio avatar Dec 30 '22 11:12 stanio