| « Peach Animation Tests!! | Fingerprinting » |
cp interactive copy
Is it just me or has the behavior of cp in linux distributions changed recently? cp is non-interactive by default so a lot of people, myself included, set an alias to include the -i flag so that cp was interactive by default.
alias cp=cp -i
But I used to enjoy the fact that if I set this alias it would prompt me when overwriting files but if there was a situation where I wanted it to be non-interactive I could do that by specifying -f. Basically, the last -i or -f would win. I want interative by default but the ability to specify non-interactive at my discretion.
However, recently or so, I noticed that several linux distributions include a cp that if you specify a cp -i alias you cannot specify -f to use non-interactive mode. The -f is ignored or at least doesn't cancel out the -i. Perhaps there is another way do to what I want but I'm unaware of it at the moment. Currently I have to remove the alias, do the non-interactive copy, and then reinstate the alias. Super annoying.
Update: You can bypass an alias by putting quotes around the command like so,
"cp" source destination
3 comments
I'm used to using -f as well, when needed, now I can't.
Would love to see this solved. Use CentOS/RHEL primarily.
$ /bin/cp -f blah2 blah
Yah, that's the point. On some systems cp -f wouldn't work. It would still be in interactive mode even though you specified the force option.
Bypassing the alias wouldn't really be cp -f. cp -f would get evaluated as cp -i -f. In this case it should ignore the -i but it doesn't. You have to really bypass the alias by doing a
"cp" source destination