Kàn dào lǎoshī lái le, xuéshēngmen gǎnmáng zuò hǎo.
When they saw the teacher coming, the students hurriedly sat properly.
Tips
usage
赶忙, 赶紧 (gǎnjǐn), and 赶快 (gǎnkuài) are near-synonyms. 赶忙 emphasizes a reaction to a situation (you see something and hurry to respond). 赶紧 and 赶快 are more general urgency.