summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-12-09 17:44:28 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2019-12-09 17:44:28 +0100
commit57dbe35fb68dda4888fc4c9e8c8d0b3106a8a21c (patch)
tree1935a2646569c68ab3310afc6bb3dd36e4dfa226 /rc
parent1bfde841484fadb1c41f41a6279e7e070f61a31b (diff)
downloadplan9front-57dbe35fb68dda4888fc4c9e8c8d0b3106a8a21c.tar.xz
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.
Diffstat (limited to 'rc')
-rwxr-xr-xrc/bin/console16
1 files changed, 16 insertions, 0 deletions
diff --git a/rc/bin/console b/rc/bin/console
new file mode 100755
index 000000000..87f24a726
--- /dev/null
+++ b/rc/bin/console
@@ -0,0 +1,16 @@
+#!/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]