Closed jameskim0987 closed 3 weeks ago
While experimenting with complgen, I noticed that when I try to source the output of complgen aot ..., I get the following error:
complgen
source
complgen aot ...
$ source mygrep.bash -bash: mygrep.bash: line 127: conditional binary operator expected -bash: mygrep.bash: line 127: syntax error near `"literal_transitions[$state]"' -bash: mygrep.bash: line 127: ` if [[ -v "literal_transitions[$state]" ]]; then'
After some searching, it looks like all instances where -v is used in an if condition, it needs to be surrounded with [ ] instead of [[ ]]
-v
[ ]
[[ ]]
All 7 instances for bash: https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L123 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L132 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L144 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L442 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L449 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L469 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L493
bash
I manually tried changing from [[ ]] to [ ] and it resolved the error.
TODOs:
The cause of this looks the same as in https://github.com/adaszko/complgen/issues/56
Closing issue https://github.com/adaszko/complgen/issues/56#issuecomment-2395527245
While experimenting with
complgen
, I noticed that when I try tosource
the output ofcomplgen aot ...
, I get the following error:After some searching, it looks like all instances where
-v
is used in an if condition, it needs to be surrounded with[ ]
instead of[[ ]]
All 7 instances for
bash
: https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L123 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L132 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L144 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L442 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L449 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L469 https://github.com/adaszko/complgen/blob/56bd58aa278a6ddc412c926de15cdd38f4f3c355/src/aot/bash.rs#L493I manually tried changing from
[[ ]]
to[ ]
and it resolved the error.TODOs:
[[ ]]
to[ ]