#!/bin/sh # Helper to use vconsole. # It is easier to write. # vc without argument presents the list of devices managed by # mconcole. If the file /etc/mconsole/index exists, it prints it INDEX=/etc/mconsole/index ALIASES=/etc/mconsole/aliases if [ $# = "0" ] ; then if [ -f $INDEX ] ; then echo cat $INDEX echo else (for file in /etc/mconsole/*.serial /etc/mconsole/*.comtrol do case $file in /etc/mconsole/\*.serial) ;; /etc/mconsole/\*.comtrol) ;; *) cat $file | while read line rest do case $line in port=*|baud=*|host=*) ;; *) echo $line ;; esac done esac done if [ -f $ALIASES ] ; then cat $ALIASES | while read a b do if [ "$a" != "" ] ; then echo $a fi done fi ) | sort fi else A1="$1" shift if [ -f $ALIASES ] ; then NEWA1=`cat $ALIASES | while read a b do if [ "$a" = "$A1" ]; then echo $b break fi done` if [ "$NEWA1" != "" ] ; then case "$NEWA1" in "ssh "*) exec $NEWA1 vc $A1 $* ;; *) exec vconsole "$NEWA1" $* ;; esac else exec vconsole "$A1" $* fi fi fi