Thanks it works perfectly.
But could you explain exactly how it works?
I understood how the pipe works, but I don't understand the difference between "2>1" and "2>&1".
Code:
$false | cp -irv toto toto2/ 2>1
`toto/newfile10' -> `toto2/toto/newfile10'
Code:
$false | cp -irv toto toto2/ 2>&1
cp: overwrite `toto2/toto/file'? cp: overwrite `toto2/toto/newfile'? cp: overwrite `toto2/toto/newfile2'? cp: overwrite `toto2/toto/newfile3'? cp: overwrite `toto2/toto/newfile4'? cp: overwrite `toto2/toto/newfile10'? `toto/newfile12' -> `toto2/toto/newfile12'
I know that 0=stdinput, 1=stdoutput, 2=stderr.
But why "&1" instead of "1"?
I also tried redirecting stdin to stdout to output "false", but instead it asked me for confirmation:
Code:
$false | cp -irv toto toto2/ 0>&1
cp: overwrite `toto2/toto/file'?
edit:
OK, I see, I just created some useless 0,1 and 2 files... ^^