Hi,
I have created a script which will move the file passed as $1 to a particular folder.
In the .profile of my unix user i have created an alias as
alias rm="$HOME/script"
Now i want that to do
alias rm="$HOME/script"
alias \rm="$HOME/script"
alias \rm -rf ="$HOME/script"
alias rm -rf ="$HOME/script"
It does not take rm -rf as ab alias.
How to do this.
you already have an alias for rm, so using rm -rf resluts in executing
$HOME/script -rf
so there is no need to specify arguments, and afaik it's not possible
Use functions, not aliases.
unalias rm
rm()
{
if [ "$1" = "-rf" ]
then
shift
$HOME/script "$@"
else
command rm "$@"
fi
}