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

Aliases should take precedence over builtin commands #106

Open
nfischer opened this issue Jan 10, 2017 · 0 comments
Open

Aliases should take precedence over builtin commands #106

nfischer opened this issue Jan 10, 2017 · 0 comments

Comments

@nfischer
Copy link
Collaborator

In bash and zsh, you can do aliases like this:

$ alias ls='ls -l'
$ ls # actually invokes `ls -l`
drwxr-xr-x  5 1000 1000      4096 Jun  9 05:25 dir1
drwx------  3 1000 1000      4096 Jan 15 13:43 dir2
drwxrwxr-x  2 1000 1000      4096 Jan 15 13:42 dir3
drwxrwxr-x  3 1000 1000      4096 Sep 18 18:20 dir4

This is not currently possible in cash, since it looks like calling ls immediately invokes the builtin ls command (no options).

Also, when fixing this, we should make sure to test for the recursive case. If we use alias ls='ls -l', calling ls should invoke the alias, which invokes the builtin.

On the other hand, if we have something more complex:

$ alias ls='ls -l'
$ alias foo='ls'
$ foo # this ultimately invokes `ls -l`

We should make sure to evaluate aliases in such a way that they don't cause cycles.

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

No branches or pull requests

1 participant