[Arduino Zero] Problem uploading my code

Hey there ! First, please know that i am french, so... Well you know, sometime I do some mistakes ^^'

Well, to expose my problem: I'm in a club in france, where we have to do a robot, but it will be a very small robot, like the size of a palm ! But we need a powerful processor, so we choosed an Atmel, actually the same Atmel that is on the Zero, so we need to be able to program it without the Arduino software, but for testing purpose the Arduino board is way easier to use !

So, to have all the comand lines to do the compilation and the upload, I displayed the code in the arduino software (Yes, I have to do it with Linux ^^):

But, when i make a script (.sh) the .ino is compiled but it can't upload !

The script: Script.sh - Pastebin.com (Yes, I know, I use a temporary folder, but I don't close the arduino software, so the folder still exist)

And here is the error: Bug - Pastebin.com (I executed "bash Script.sh" before, then there is a lot of lines...)

My .ino is compiled in a .bin, there isn't the problem, it's just when I upload, when the Arduino soft does it, there isn't any problem, when it's me, I'm stuck with the breakpoint problem... And to close the shell, I have to do a Ctrl+C, because it's stuck on that last line...

I searched day and night to find a solution, but I didn't find anything !

Yeah, I know it's really specific, but if someone have just a begining of a thing, that would be good to me !

I think you would be more likely to get help if you posted your script and error in code tags here so people don't have to download it from pastebin to see it.