plan9fox/rc/bin/console
cinap_lenrek 57dbe35fb6 console(8): add console command and manpage
the console command runs a command or the system shell under
a new instance of kbdfs, optionally providing a serial console
when $console environment variable is set.
2019-12-09 17:44:28 +01:00

16 lines
257 B
Bash
Executable file

#!/bin/rc
if(~ $#* 0)
*=(rc -i)
a=$console(1)
if(! ~ $#a 0){
if(! ~ $a /* '#'*)
a=/dev/eia^$a
if(test -e /dev/kbd){
@{rfork ns; aux/kbdfs; exec $* </dev/cons >/dev/cons >[2=1]} | tee $a
exit
}
}
aux/kbdfs $a
exec $* </dev/cons >/dev/cons >[2=1]