K
KenJackson
Guest
I have a number of aliases in my ~/.bashrc file, including this one:
The -i switch make cp prompt me if it's going to overwrite an existing file. That's normally what I want.
But if I use the -f switch, I want it to take precedence and force the copy, regardless of whether it overwrites a file. But it doesn't work. Actually, it doesn't matter if I use the alias or not--when you use -i and -f in the same command, the -i overrides the -f.
I guess I could come up with some elaborate function to inspect all the arguments, but I'm hoping for a simpler solution. Is there one?
Code:
alias cp="/bin/cp -i"
But if I use the -f switch, I want it to take precedence and force the copy, regardless of whether it overwrites a file. But it doesn't work. Actually, it doesn't matter if I use the alias or not--when you use -i and -f in the same command, the -i overrides the -f.
Code:
$ touch test1 test2
$ /bin/cp -i -f test1 test2
/bin/cp: overwrite `test2'?
I guess I could come up with some elaborate function to inspect all the arguments, but I'm hoping for a simpler solution. Is there one?