What does this really mean? "tty -s && stty istrip"


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What does this really mean? "tty -s && stty istrip"
# 1  
Old 02-11-2011
What does this really mean? "tty -s && stty istrip"

I am having hard time understanding what this really do to the environment? I do understand this part "tty -s && stty " but not "istrip"

Code:
 
# stty command is executed only if a tty is attached to the process.
# stty istrip : Strip input characters to 7 bits
tty -s && stty istrip

I am also having hard time understanding what many of the options associated with "stty" really work!?
Is there a tutorial or example based reference or a book that explain what all options for "tty" "stty" do clearly?
Here one of the man pages I am looking at -->

HTML Code:
http://resin.csoft.net/cgi-bin/man.cgi?section=1&topic=stty
# 2  
Old 02-11-2011
Code:
stty istrip]

sets the tty driver to strip input characters to 7bit ascii. ASCII is formally defined as having only 7 bits. "8 bit" ASCII is sometimes called "extended ascii". istrip is used to force extended ascii into standard ascii. UTF-8 is an extended ascii encoding for some UNIX locale settings. SO if you want only 7 bit ascii "inside" the terminal, strip off the leading bit.

Most of the stuff in stty dates from a time when there were lots of very slow peripheral devices, like modems that ran at 50 baud. In other words, you can safely ignore a lot of it. I do not know of a reference for stty settings.

Last edited by jim mcnamara; 02-11-2011 at 12:27 PM..
# 3  
Old 02-11-2011
What exactly one would be saving by setting "istrip"?
[ memory space/CPU cycles/Modem baud speed ]

It feels like it is going to accept only non-extended ASCII characters i.e from 0-127.

If its really the "baud speed", my machine has this setting..
$> stty -a | grep baud
speed 38400 baud;

So there is no point in setting this on my machine right !?

I also wonder why anyone would still want to use character set[s] other than UTF-8 in this internet age!
# 4  
Old 02-11-2011
You are probably using a psuedo-tty. A real tty like this is not going to work with unicode. Real tty's and the newer glass ttys like the vt-100 used ascii and its a 7 bit code. They might connect via 300 baud modem. 1200 baud if you're lucky. Transmitting all those bit-8's, which should be zero, over a slow serial connection was not very attractive. That's why we stripped them.

But decisions like that were made by a program called getty before the login program ever ran. The line of code you ask about seems goofy to me. It will have no effect on a psuedo tty and seems like a potential disaster on a real one. I would like to know what the author was thinking.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find files in sub dir with tag & add "." at the beginning [tag -f "Note" . | xargs -0 {} mv {} .{}]

I am trying find files in sub dir with certain tags using tag command, and add the period to the beginning. I can't use chflags hidden {} cause it doesn't add period to the beginning of the string for web purpose. So far with my knowledge, I only know mdfind or tag can be used to search files with... (6 Replies)
Discussion started by: Nexeu
6 Replies

2. UNIX for Beginners Questions & Answers

Echo "abc" | sed - r 's/a/&_&/

I want to know the working of & here step by step using sed command. (1 Reply)
Discussion started by: Preeti07
1 Replies

3. Web Development

How would I mod_rewrite "/~a1Pha" and "/=a1Pha" to "/paste/a1Pha.htm"? (internally & externally)

Basically I want to shorten URLs on my html pasting site (pasteht.ml), by using "/~a1Pha" instead of "/paste/a1Pha". The ID is 5 numbers and letters, both cases. For example: /~idnum serves /paste/idnum.htm /=idnum serves /paste/idnum.htm /paste/idnum redirects to /~idnum (to update any old... (0 Replies)
Discussion started by: phillips1012
0 Replies

4. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

5. Shell Programming and Scripting

Replace dashes positions 351-357 & 024-043 with 0 & replace " " if exis with 04 at position 381-382

I need to replace dashes (i.e. -) if present from positions 351-357 with zero (i.e. 0), I also need to replace dash (i.e “-“) if present between position 024-043 with zero (i.e. 0) & I replace " " (i.e. 2 space characters) if present at position 381-382 with "04". Total length of record is 413.... (11 Replies)
Discussion started by: lancesunny
11 Replies

6. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

7. Shell Programming and Scripting

Append && echo "success" to all commands

I am learning to build from SVN and other tools, with a lot of copying and pasting from forums. I like to append && echo "success" to all commands so that I can see at a glance if things went all right. Is there a way that I can have the bash shell append this to all commands? Thanks! (5 Replies)
Discussion started by: dotancohen
5 Replies

8. Shell Programming and Scripting

"sed" to check file size & echo " " to destination file

Hi, I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
Discussion started by: jockey007
7 Replies

9. What is on Your Mind?

[[ $(date +%Y) == 2007 ]] && echo "Happy New Year"

Same as the Title! :) (2 Replies)
Discussion started by: ripat
2 Replies

10. UNIX for Dummies Questions & Answers

Run away "bootpgw" & "inetd"

Hello All. I'm get the following messages posted to the /var/adm/syslog file ever second and not sure on how to stop the process. May 14 15:50:52 a3360 bootpgw: version 2.3.5 May 14 15:50:52 a3360 inetd: /etc/bootpgw exit 0x1 As said about this gets logged every second only thing that... (4 Replies)
Discussion started by: cfaiman
4 Replies
Login or Register to Ask a Question