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

Special tokens don't work in aliases #286

Open
John-Bush14 opened this issue Dec 3, 2024 · 1 comment
Open

Special tokens don't work in aliases #286

John-Bush14 opened this issue Dec 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@John-Bush14
Copy link

Some special tokens don't work in aliases.

affected tokens (I found)

  • &&
  • ;
  • |
  • \
  • >
  • >>

example affected commands

  • alias test='echo && echo succes'; test

    • which wil return " && echo succes"
  • alias test='echo; echo succes'; test

    • where it thinks ; is part of the command an returns the error "ERROR echo;: command not found"
@reubeno reubeno added the bug Something isn't working label Dec 3, 2024
@reubeno
Copy link
Owner

reubeno commented Dec 3, 2024

Thanks for reporting this! I can reproduce the error you're seeing.

I took a quick look back at the implementation; today, brush's current implementation of aliases only supports replacing the arguments of a simple command being invoked. The examples you mention are cases that require the full expected functionality hinted at in the comments on #57 -- i.e., that the shell needs to expand the alias early enough in the parsing process to handle the expansion including other command syntax (e.g., redirection, pipelines, for loops or other compound commands).

@39555 -- if we end up moving to an alternate parser as you've been proposing, that seems like it would also enable us to properly implement aliases once and for all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants