Re: Re: Menu on bootup?
Martin D Kealey <[email protected]> Tue, 18 Oct 2011 09:59:45 +1300 (NZDT)
| Newsgroups | gmane.org.user-groups.linux.new-zealand.general |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 17 Oct 2011, Nevyn wrote: > exec </dev/console >/dev/console 2>&1 > The script stuff is fairly trivial. I've never really understood file > descriptors. Is anyone able to explain that first line to me? > > exec </dev/console >/dev/console 2>&1 The "exec" built-in is a bit funny. Unlike most shell commands where if you preface a variable-setting or set some I/O-redirection they only apply to just that one command, for "exec" (without a filename) they remain in effect for the rest of the script or shell session. (Using "exec" *with* a filename results in the current shell session being *replaced by* that other program.) In this case it means connect the stdin and stdout each to /dev/console, and then connect stderr to wherever stdout is connected. /dev/console is a generic device that starts out meaning /dev/tty1, but can be redirected to an xconsole, or into syslog, or wherever is useful. Not sure why they'd bother connecting stdin, unless they expect that something might possibly need keyboard input, and that would only work if it's still connected to /dev/tty1. It would be shorter and more appropriate to write exec </dev/null >/dev/console 2>&1 -Martin _______________________________________________ NZLUG mailing list [email protected] http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug