9vxp (618B)
1 #!/bin/sh 2 # 9vxp: run commands from arg or file 3 # Reads configuration from ~/.9vxp.ini 4 5 fatal() { echo $* 1>&2; exit 1; } 6 abs() { f=$1 7 echo $f | grep -q '^/' || f=`pwd`/$f 8 ls $f || fatal $1 not found; } 9 usage="usage: 9vxp profile [9vx options]" 10 11 p=$1 12 shift || fatal $usage 13 test -f "$p" && p=". '#Z`abs $p`'" 14 15 # Defaults 16 root=${PLAN9VXROOT:=/usr/local/plan9vx} 17 conf=${PLAN9VXCONF:=~/.9vxp.ini} 18 19 initprofile='. /rc/bin/termrc 20 home=/usr/$user; test -d $home && cd 21 '$p' || reboot exit with errors: $status 22 reboot' 23 test -f $conf && conf="-f $conf" || unset conf 24 exec 9vx -r $root $conf "$@" -i "$initprofile"