Escape Sequence for Capital Letters Input at Shell Not Working

Hello,

I am running Solaris 8. When issuing the command "stty lcase" all text which is output to the terminal are capitalized. Letters that are supposed to be capitals are preceded by a backslash during output. All text which is input is converted to lower case. This is the expected behaviour to my understanding of "stty lcase".

According the documentation for termio(7I) it mentions that "If XCASE is set and ICANON is set, an upper case letter is accepted on input if preceded by a backslash (`\')"

Problem:

I have confirmed that both xcase and icanon are set. However; at the shell, when trying to enter a capital letter (such as the capital letter "A") using the escape sequence: \A, the shell interprets it as a lower case letter "a". What do I need to do in order to be able to enter capital letters at the shell when "stty lcase" is set? The terminal that I will eventually be using is an ASR-33 Teletype that can only handle capital letters (input and output).

Interestingly, using the vi editor, the escape sequence works. If I enter a backslash it does not echo back immediately. When I follow the backslash by a second character such as the letter A, both the backslash and the letter A are echoed back, and is stored in the saved file as a capital letter "A". Is it possible to have the shell behave in the same manner?

Vi knows what to flip, so

:!stty -a

and start flipping things?

Did you Try:

ctrl-V[capital letter]
#Example of what it looks like:
^VH
1 Like

Normally, ctrl strips off the bits that say lower case and upper case, driving key codes into the lower 32 places, so ctrl-@ is 0x00, ctrl-A is 0x01, etc., but keyboards can be programmed to do other things. However, ctrl-V is the escape character for the tty cook, so it opens up additional possibilities.

1 Like

@Jim:

Ctrl+V[capital letter] works!

(Currently I am testing this on a PC and will eventually interface an ASR33):

At fist, since everything was being output in capital letters regardless of input (stty lcase) it threw me off. When I pressed ctrl+V followed by a letter (which was input in lower case and output as capital) it did *not* work.

I then pressed control+v followed by a capital letter (such as shift+F) which resulted in the following output: \F

Thank you Jim and DGPickett!

I would like to understand why this works:

stty -a indicates that LNEXT is mapped to ctrl+v.

According to the documentation of termio(7I) it mentions the following:

termio(7I)
"LNEXT (Control-v or ASCII SYN) causes the special meaning of the next character to be ignored"

@DGPickett:
You mentioned that ctrl+v is the escape character for the tty cooked mode.

Does this mean that the character typed following control+v is interpreted by the terminal driver in raw mode (i.e. the special meaning of next character ignored). Therefore processing such as that set by stty lcase (viz. iuclc) is skipped and therefore the character is taken in as an actual capital letter (and output as a formated \F [in my test above] as XCASE and ICANON are set)? Is this how it works?

Thank you.

You got it, L for Literal. Also handy for embedding line feeds in command lines, with appropriate quoting.

BTW, if vi allows Caps, running ksh in 'set -o vi' and $EDITOR=vi mode means you can take any command line to vi with esc-v. I find this and expanded command history $HISTSIZE=32767 make for great keystroke savings, so I never cd except inside (), and all the commands I recall work over and over.