find error do shell script with rsync command
I've written intentionally a wrong script in order to find the errors.
The output using the rsync command is the following:
Last login : Tue March 4 11:34:59 on console
server: ~ simonepiersigilli $ rsync- avz - progress - stats / Users / simonepiersigilli / Desktop / Test / / Users/simonepiersigilli/Desktop/Test2 / 2 > & 1
building file list ...
rsync: link_stat " / Users / simonepiersigilli / Desktop / Test / . " failed: No such file or directory ( 2 )
0 files to Consider
Number of files: 0
Number of files transferred: 0
Total file size: 0 bytes
Transferred Total file size: 0 bytes
Literal data : 0 bytes
Matched data : 0 bytes
File list size: 13
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 29
Total bytes received : 20
sent 29 bytes received 20 bytes 32.67 bytes / sec
total size is 0 speedup is 00:00
rsync error : some files Could not be Transferred (code 23) at / SourceCache/rsync/rsync-42/rsync/main.c ( 992 ) [ sender = 2.6.9 ]
server: ~ $ simonepiersigilli
The output is correct becaus the "test" folder doesn't exist
Following Apple's instruction (https://developer.apple.com/library/mac/technotes/tn2065/_index.html) I've insert 2>&1 at the end of the command, as shown by the following script.
set risultato to 0
try
set risulato to "rsync -avz --progress --stats /Users/simonepiersigilli/Desktop/Test/ /Users/simonepiersigilli/Desktop/Test2/ 2>&1"
end try
display dialogrisultato
The result does not contain neither the error, nor the output:
How can I use do shell script in order to find the error and the output?
Mac mini, OS X Mavericks (10.9.2)