[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Using less in environment without controlling tty
From:       Harald Becker <ralda () gmx ! de>
Date:       2013-07-31 20:19:15
Message-ID: 20130731221915.5774b69d () ralda ! gmx ! de
[Download RAW message or body]

Hi Sam !

>> Then try:
>>
>> cmd | setsid sh -c 'exec >/dev/tty12 2>&1 ; exec less'
>>
>Just for my own education, how would you know to
>use /dev/tty12 ? It would want to be whatever /dev/??? stdout
>is, maybe it is /dev/ttyS0

tty12 has just been chosen for example, programmer needs to know
where he wants to send the data to display.

And as you are requesting how to get the name of a used tty, try:

  tty

gives tty of stdin

  tty 0<&1

gives name of stdout

  tty 0<&2

gives name of stderr


This all relies on the C library function ttyname(), see man page
for tty(1), and ttyname(3).

The problem is, depending on implementation of this function it
doesn't work when /proc and/or /sys is not mounted properly, or
not accessible (like in chroot).

--
Harald
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic