use interactive shells and bind to work around issue in bash #506
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a workaround to #502 where environment variables in file names are not completed. The issue is that calling
compgen
in a nested bash did not recognize the environment variables. It looks like this is a bug that was fixed in bash 5.3 but it still affects earlier versions (https://savannah.gnu.org/support/index.php?111125) For those earlier version, callingbind
before the call tocompgen
forces the necessary initialization.This works with a normal shell, but produces a warning
line editing not enabled
because bind is meant for interactive contexts. Using-i
to turn the nested shell into an interactive shell avoids the warning. An alternative would be to pipe the warning to/dev/null
instead.