Linux alias chain commands (can recursion be avoided?)
Just do :
alias ls='clear;/usr/bin/ls'
When typing:
$ ls
First of all it will search an user defined function, it will launch it, else search in $PATH commands.
By giving the explicit path of the ls
command, recursion will be avoided.
If you put a backslash before the command name, that will disable any aliases.
alias ls='clear;\ls'
Or, like Arnaud said, just use the full path for ls.
Another way of doing this would be
alias ls='clear; command ls'
This is different from /usr/bin/ls
, as it still searches ls
in the $PATH
, but will ignore shell functions or aliases.