Reputation: 4996
Is it possible to include a wildcard in an alias, like:
alias *="echo triggered"
Upvotes: 0
Views: 292
Reputation: 123480
No. This would only trigger for a literal asterisk.
If you want to override most commands, you can botch PATH
and use command_not_found_handle
:
$ PATH=/invalid
$ command_not_found_handle() { echo "triggered"; }
$ man ls
triggered
$ firefox
triggered
$ asdfasdfasdf
triggered
This will not apply to aliases, builtins, or when running commands with full path.
Upvotes: 2