Forum comments in chronological order

Disclaimer: I am not responsible for what people (other than myself) write in the forums. Please report any abuse, such as insults, slander, spam and illegal material, and I will take appropriate actions. Don't feed the trolls.

Jag tar inget ansvar för det som skrivs i forumet, förutom mina egna inlägg. Vänligen rapportera alla inlägg som bryter mot reglerna, så ska jag se vad jag kan göra. Som regelbrott räknas till exempel förolämpningar, förtal, spam och olagligt material. Mata inte trålarna.

Aug 2021

The TTY demystified

ben
Ben in Seattle
Mon 2-Aug-2021 05:49
I wonder when I'm in bash and erasing text with backspace what stops me from erasing the bash prompt at the beginning of the line?

That's an excellent question!

Modern terminals only show what they receive, not what they send. When you hit a key, the terminal sends it to your UNIX box which then interprets it and (usually) sends it back. The illusion that what you type immediately shows up on the terminal is due to your shell choosing to echo back the keys you've hit. The backspace character (^H) is echoed back just like any other key by your shell until there is nothing left to erase except the prompt. At that point the shell simply chooses to not echo the backspace, thus keeping the prompt intact. Some shells even choose to send a different character, ^G, which rings the bell on the terminal to let you know you've hit the end.
ben
Ben in Seattle
Mon 2-Aug-2021 06:18
Great article.
For another great source on TTY devices you can go to:
http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.genprogc/doc/genprogc/ttysys.htm

Enjoy,
Ori

That site has been revamped and IBM only offers the manuals in PDF format. You can now (2021) find the TTY Subsystem for AIX documentation here:

http://public.dhe.ibm.com/systems/power/docs/aix/61/genprogc_pdf.pdf#TTYSYS