Hi Hongyi, you need to use QUIT; instead of "quit". However, the result can still hang if there is an error in the script. To prevent this, I strongly recommend to pass the --quitonbreak to gap when using it non-interactively: gap --quitonbreak myscript.g Cheers Max