Wednesday 2011-02-16

Sometimes we need a bash script to not have a tty, like when trying to get ssh-add to run the defined $SSH_ASKPASS. To drop the tty, close stdin, stdout, and stderr, then no terminal will be associated with the session.

exec  < /dev/null
exec  > /dev/null
exec 2> /dev/null

linux should have more plan9 interfaces, it'd be cool to "exec 2> /dev/log" and have cheap syslog access. For now, we can only redirect stderr to a file, unless we write a fuse interface ( not so complex to hack ).