Skip to content

Word splitting taking place #3

Description

@pesathem

Your code relies on word splitting suggestions=( $(compgen ... ) ) and the completion gives me wrong results before you set IFS=$'\n'. When you tested your function, you might have had IFS set from some previous attempts (since compgen also splits using IFS, I believe that really is the case). It's also subject to pathname expansion which is not that important here but still might be an issue in some extreme cases. set -f might be a good idea.

I believe that creating a completion that correctly handles whitespace characters and globs is extremely painful. I may have missed something of course and I might embarrass myself :) Overall it's a great article giving insight in some less known parts of bash 👍

ezgif-4-dcfe42fdea

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions