Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
robert-greene opened this issue Sep 20, 2020 · 3 comments

Comments

@robert-greene
Copy link

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

}

@de-jcup
Copy link
Owner

de-jcup commented Feb 20, 2021

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 de-jcup added the bug label Feb 20, 2021
@de-jcup de-jcup changed the title Syntax Error Syntax Error - highlighting and parse of quotation marks not correct interpreted when inisde execution part Feb 20, 2021
@de-jcup de-jcup changed the title Syntax Error - highlighting and parse of quotation marks not correct interpreted when inisde execution part Syntax Error - highlighting and parse of quotation marks not correct interpreted when inside execution part Feb 20, 2021
@de-jcup
Copy link
Owner

de-jcup commented Feb 20, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants