Re: Oddity In stty
On Sun, 2008-08-31 at 17:35 -0400, David L. Craig wrote: I can't figure this out. Why does the first pipeline suceed but the second fails? I'm running an up-to-date Sid. fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` /dev/null cat /dev/null | fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` stty: standard input: Invalid argument It's partly because stty acts on stdin, not stdout as you might initially expect, and partly because of the way in that the shell appears to handle back-ticked command evaluation. 1. echo `stty -a` /dev/null It appears that the `stty -a` is forked /before/ the /dev/null is applied. (This may be documented; I haven't looked.) 2. cat /dev/null | echo `stty -a` The pipe redierction appears to be applied before the `stty -a` is processed, so that stdin is not attached to your terminal when the stty runs. David L. Craig [EMAIL PROTECTED] wrote: Well, I figured out a way around it: stty -a /dev/tty Solaris behaves similarly. I'm surprised this isn't documented behavior. The behaviour of stty /is/ documented, indirectly: -F, --file=DEVICE open and use the specified DEVICE instead of stdin ... Handle the tty line connected to standard input. Without arguments, prints baud rate, line discipline, and deviations from stty sane I guess, like many man pages, you have to know what you're looking for before you can see it. Chris -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Oddity In stty
On Sun, 31 Aug 2008, David L. Craig wrote: On Sun, 2008-08-31 at 17:35 -0400, David L. Craig wrote: I can't figure this out. Why does the first pipeline suceed but the second fails? I'm running an up-to-date Sid. [EMAIL PROTECTED]:~$ fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` /dev/null [EMAIL PROTECTED]:~$ cat /dev/null | fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` stty: standard input: Invalid argument fold: option requires an argument -- w Try `fold --help' for more information. [EMAIL PROTECTED]:~$ Well, I figured out a way around it: stty -a /dev/tty Solaris behaves similarly. I'm surprised this isn't documented behavior. You can file a wishlist bug against coreutils, asking for the documentation update... -- One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie. -- The Silicon Valley Tarot Henrique Holschuh -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Oddity In stty
I can't figure this out. Why does the first pipeline suceed but the second fails? I'm running an up-to-date Sid. [EMAIL PROTECTED]:~$ fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` /dev/null [EMAIL PROTECTED]:~$ cat /dev/null | fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` stty: standard input: Invalid argument fold: option requires an argument -- w Try `fold --help' for more information. [EMAIL PROTECTED]:~$ -- May the LORD God bless you exceedingly abundantly! Dave Craig - - - - - - - - - - - - - - - - - - - - 'So the universe is not quite as you thought it was. You'd better rearrange your beliefs, then. Because you certainly can't rearrange the universe.' --from _Nightfall_ by Asimov/Silverberg -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Oddity In stty
On Sun, 2008-08-31 at 17:35 -0400, David L. Craig wrote: I can't figure this out. Why does the first pipeline suceed but the second fails? I'm running an up-to-date Sid. [EMAIL PROTECTED]:~$ fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` /dev/null [EMAIL PROTECTED]:~$ cat /dev/null | fold -w `stty -a | head -1 | awk '{print $7}' | tr -d ';'` stty: standard input: Invalid argument fold: option requires an argument -- w Try `fold --help' for more information. [EMAIL PROTECTED]:~$ Well, I figured out a way around it: stty -a /dev/tty Solaris behaves similarly. I'm surprised this isn't documented behavior. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]