|
|
Control+T in Terminal shows time snapshot
Control-M and Control-J create a CR or LF (nominally respectively, though I'm not sure what the practical difference is here).There is no difference. In ASCII, Control-M (also written ^M) is CR and Control-J (^J) is LF. For example, a pure Unix terminal program can't tell the difference between you typing ^M vs return. Control-V followed by another letter lets you type other control characters in.That's more to do with the command-line editor you're currently using than the shell, i.e., that's what you type in vi. ---
- Paul
Control+T in Terminal shows time snapshot
Any Unix program can see the CR's and LF's separately if the programmer chooses. They just have to turn off icrnl or put the tty into raw mode. To say that there is no difference between the two is a little misleading.
Example: #!/bin/sh stty -icrnl echo "Type something, hit control M or enter/return a few times, then hit control J" read ans echo "You typed:" echo $ans | od -a stty icrnlAlso, control V is the usual setting for the tty's "literal next" (lnext) setting and is not limited to command line editors. Try running a simple command like sleep 30, then hit ^V^M and ^V^J to see that there is a difference between the two.In Terminal the key labelled "return" will produce the same results as hitting ^M because they're both ways to generate a carriage return (CR). If icrnl is on (see stty -e) then these will be mapped to newlines. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|