Aliases should take precedence over builtin commands
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
In bash and zsh, you can do aliases like this:
```bash
$ 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:
```bash
$ 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.