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

Alias is not being executed #3

Open
VuiMuich opened this issue Apr 30, 2023 · 3 comments
Open

Alias is not being executed #3

VuiMuich opened this issue Apr 30, 2023 · 3 comments

Comments

@VuiMuich
Copy link

Hi,
thanks for this crate, I was trying to use it for the atuin shell history, but it seems aliases from the shell config are not respected.
Or am I missing some point in the docs?

@magiclen
Copy link
Owner

magiclen commented May 1, 2023

It seems that alias does not work in a non-interactive shell. According to https://stackoverflow.com/questions/1615877/why-aliases-in-a-non-interactive-bash-shell-do-not-work, you can run shopt -s expand_aliases to enable it.

  1. Create a bash file (assuming your shell is bash)
    #!/bin/bash
    shopt -s expand_aliases
    
    # you can add your alias here
  2. Set the BASH_ENV environment variable to the path of the bash file.
  3. Now you can use alias commands in a non-interactive shell.

@VuiMuich
Copy link
Author

VuiMuich commented May 1, 2023

Thanks for the quick answer and good find on that stackexchange article.

Bummer side of this: atuin has support for bash, zsh, fish and nushell at the moment.

Do you think adding alias expansion as a feature (returning some error like "Alias expansion not supported for ") would be realistic to who's for?
Tbh I haven't had any looks at your code base so far at all, so I have no idea if you already are doing stuff for specific shells.

@magiclen
Copy link
Owner

magiclen commented May 1, 2023

Assuming you are using bash, you can use bash -i -c "<Your Command> to execute a command in an interactive shell. I'm not planing to provide API for interactive/login shell because Windows has no such thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants