Script x start.sh
Jump to navigation
Jump to search
#!/bin/bash echo "Avvia xinit con il programma passatogli," echo "sul DISPLAY eventualmente specificato" ### check # if test -z "$1"; then echo echo "Usage: $0 <programToStart> [displayNumber] [layout]" echo exit -1; fi; if test "$3" == ""; then LAYOUT=""; else LAYOUT="-layout $3" fi; if test "$2" == ""; then export DISPLAY=":1"; else export DISPLAY="$2"; fi; NUM="`echo $DISPLAY | cut -b 2- | cut -d . -f 1`" if test -f "/tmp/.X$NUM-lock"; then echo echo echo echo "DISPLAY :$NUM gia' in uso o bloccato in /tmp/.X$NUM-lock" while test -f "/tmp/.X$NUM-lock"; do NUM=$((NUM+1)); export DISPLAY=:$NUM; done fi; MAIN_PROG=`which $1`; if test ! -x "$MAIN_PROG"; then echo echo "Cannot execute $1"; echo exit -1; fi; echo echo "Display: "$DISPLAY echo "Program: "$MAIN_PROG echo # window manager xinit $MAIN_PROG -- $DISPLAY $LAYOUT # End