Serial output to linux commands

I am having trouble figuring out how to convert my Arduino's serial output to actual software commands. I have no problems getting the computer to read serial input, but I don't know how to convert that to commands. Hypothetically, if I were to script something that would make the computer execute a command whenever it received serial input, how would I go about doing that?

Hypothetically, if I were to script something that would make the computer execute a command whenever it received serial input, how would I go about doing that?

Hypothetically, you would parse the serial data, extract the command and arguments, and call the appropriate API.

Practically, put your hands in your pockets while you ask the question. All that hand-waving is communicating nothing.