Wiadomość napisana przez Cyril Brulebois w dniu 2011-03-09, o godz. 14:36:
[..] >> Is it possible to detect reliably whether a script executes on the >> console or in X Window? For Linux I've used a code like this: >> >> case `readlink /proc/self/fd/2` in >> /dev/tty[0-9]*|/dev/vc/[0-9]*|/dev/console) >> ;; >> *) >> echo We are not on the Linux console, the console is left >> unconfigured. >> exit 0 >> ;; >> esac > > (I think I've mentioned it can't work on GNU/kFreeBSD, there's no fd/ > directory in the linprocfs compatiblity layer.) Not sure about the Debian userland, but the standard FreeBSD way would be to use tty(1): $ tty /dev/ttyv0 -- If you cut off my head, what would I say? Me and my head, or me and my body? -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/b94dd3e7-7c30-48b1-9b35-8875b5f7e...@freebsd.org