Yes mam

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
3,698
Reaction score
3,533
Credits
32,976
This one is about as simple as it gets.
Recently I was cleaning up an old hard drive. I wanted to copy everything off of it before I re-formatted it.

so I used the trusty old...
Code:
cp -rvf /mnt/* /destination/directory
Because the "f" is supposed overwrite existing files, right?

Well, instead, it was asking thousands of times, "Do you want to over write existing file Y/n?".
Well after about a dozen of those, that gets old, I saw that I still had 11,735 files to go. Not good. I was going to have one tired finger
from pressing "Y" eleven thousand more times. So what do we do?

Just say yes.
Code:
yes | cp -rvf /mnt/* /destination/directory

This will pipe the "yes" answer to any commands I'm doing.

I noticed I didn't have a "no" command. But I'm not sure what I would have used it for.
 
Last edited:


As silly as it might seem:
Code:
yes | tr "y" "n" |cp -rvf /mnt/* /destination/directory
or, for an abbreviated form:
Code:
:
;)
 


Members online


Top