Visit Our UNIX and Linux User Community


Escape Sequence for Capital Letters Input at Shell Not Working


 
Thread Tools Search this Thread
Operating Systems Solaris Escape Sequence for Capital Letters Input at Shell Not Working
# 1  
Old 06-12-2013
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?
# 2  
Old 06-12-2013
Vi knows what to flip, so
Code:
:!stty -a

and start flipping things?

Last edited by jim mcnamara; 06-12-2013 at 07:24 PM..
# 3  
Old 06-12-2013
Did you Try:
Code:
ctrl-V[capital letter]
#Example of what it looks like:
^VH

This User Gave Thanks to jim mcnamara For This Post:
# 4  
Old 06-13-2013
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.
This User Gave Thanks to DGPickett For This Post:
# 5  
Old 06-13-2013
@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.

Last edited by rstor; 06-13-2013 at 02:45 PM..
# 6  
Old 06-13-2013
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.

Previous Thread | Next Thread
Test Your Knowledge in Computers #827
Difficulty: Medium
Douglas Crockwell first specified and popularized the JSON format.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract distinc sequence of letters

Hallo, I need to extract distinct sequence of letters for example from 136 to 193 Files are quite big, so I would prefer not to use "fold -w1" Thank you very much Input file look like this: 1 cttttacctt catgtgtttt tgcagatatt tgttcataat aacatcttct ttttaagtta 61 ttaaaatctt... (4 Replies)
Discussion started by: kamcamonty
4 Replies

2. Shell Programming and Scripting

changing all characters of a file to capital letters

Hi guys. I have file named output.txt containing file names. one per line. I use this command to convert all characters to capital letters and write to the same file. cat output.txt | tr 'a-z' 'A-Z' > output.txtBut at the end output.txt is emtpy. Could anyone help?? (6 Replies)
Discussion started by: majid.merkava
6 Replies

3. Shell Programming and Scripting

Put parentheses around all capital letters using SED

Hello everyone I tell you that I'm trying to do a bash program that can put parentheses around each capital letter of each line using SED. I tell you probe with: sed -e '1,$s/A/(A)/g' "$file" but only add parentheses in A. then tested with: sed 'y/AB/(A)(B)/' "$archivo" but it... (3 Replies)
Discussion started by: adiegorpc
3 Replies

4. Shell Programming and Scripting

escape sequence for $

Hi all, I have a requirement where the variable name starts with $, like $Amd=/home/student/test/ How to work wit it? can some one help me, am in gr8 confusion:confused: (5 Replies)
Discussion started by: shreekrishnagd
5 Replies

5. UNIX for Dummies Questions & Answers

How to search for capital letters

Hi, I just want to search a file for any words containng a capital letter and then display a list of just these words! I have been trying grep but to no has not helped.(im using the bash shell) (1 Reply)
Discussion started by: djdaniel3
1 Replies

6. UNIX for Advanced & Expert Users

want to view the escape sequence

Hi, Is it possible to view the escape sequence in the ascii file. That is I want to see the newlinw character,tab ........ etc Thanks Sweta (4 Replies)
Discussion started by: sweta
4 Replies

7. Shell Programming and Scripting

change small letters to capital

hi guys, I know this might be very simple for u but not for me. I simply want to print the active users, changeing the first letter in their names to capital. i guess sed it's useful but don't know how to find the correspondign capital letter and don't know how to change just the first... (16 Replies)
Discussion started by: atticus
16 Replies

8. Shell Programming and Scripting

Change a parameter to be in capital letters

Hi, I have a korn shell script with 1 parameter. My script deletes certain files, for example.... sid=$1 rm $ORC/dbs/orapwd${sid} #orapwddb1 rm $ORC/dbs/lk${sid} #lkDB1 In the first file, the $sid must be in small letters and in the second file, the $sid must be in capital... (4 Replies)
Discussion started by: n8575
4 Replies

9. Shell Programming and Scripting

Escape sequence

Hi, I have got an application through which an user will submit an address like "c:\tuser\abc". This application calls a script and passes the address to the scripts positional parameter say $1. So $1 should contain "c:\tuser\abc", but when $1 is echoed the "\t" and "\a" are interpreted to... (4 Replies)
Discussion started by: puspendu
4 Replies

10. UNIX for Dummies Questions & Answers

capital letters GONE!

I have an odd issue. I am trying to copy some files/folders to my linux box via a burned CD which I created on my mac. When I browse the files on the mac (or my windows box), everything looks fine (some of the folder names start with a capital letter, which is needed for everything to work... (8 Replies)
Discussion started by: blogg
8 Replies

Featured Tech Videos