Closed laurentsimon closed 2 years ago
Is that valid Bash? I don't think it is, at least from what I can see:
$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ bash -c 'echo ${${(%):-%x}:a:h}'
bash: line 1: ${${(%):-%x}:a:h}: bad substitution
Good point. @godofredoc any comment?
It is valid zsh returning the current directory. This is the result from running with zsh:
macbook$ zsh -c 'echo ${${(%):-%x}:a:h}'
/private/tmp
macbook$
Right, though that file has a bash shebang, not a zsh one. This parser does not yet support zsh - see #120.
Thanks, makes sense. Feel free to close the issue. Thank you so much for such a prompt reply
I'm going to close this in favor of #120, then. I do sort of get why https://github.com/flutter/engine/blob/main/tools/fuchsia/devshell/lib/vars.sh uses bash in its shebang - the script is mostly bash. But the one line that isn't bash still makes the shebang misleading :) It works with bash because it only parses lines when it needs to execute them, but other tools like shfmt or IDEs will often parse all source code upfront, leading to problems like this one.
This file https://github.com/flutter/engine/blob/main/tools/fuchsia/devshell/lib/vars.sh#L8 triggers an error
parameter expansion requires a literal Info