Reputation: 453
I can't retrieve the way to define a shell alias (in bash) like this one :
alias suppr='/usr/bin/find . -name "*~" | xargs rm -f'
but with "*~" as a parameter of the alias. I would like to use it like : suppr ".bak" or suppr "*.svn" etc...
(it's just a dummy example here)
Upvotes: 0
Views: 65
Reputation: 195029
why not save your command as a script, and put the script in Path? you can name the script file as anything.
Upvotes: 2
Reputation: 212158
Use a function:
suppr() { /usr/bin/find . -name "$@" | xargs rm -f }
In general, functions are more flexible and safer to use than aliases. In fact, many people argue that functions should always be used instead of aliases.
Upvotes: 3