#!/bin/bash ZEROFILE='/usr/X11R6/lib/X11/xkb/xkbcomp' TARGETFILE='/usr/X11R6/bin/xkbcomp' if [ ! -a$TARGETFILE ] then echo $TARGETFILE does not exist. exit -1 fi if [ ! -a$ZEROFILE ] then echo $ZEROFILE does not exist. echo Creating symlink. # ln -s $TARGETFILE $ZEROFILE exit -1 fi if [ -h$ZEROFILE ] then echo $ZEROFILE is a symlink. exit -2 fi TEMP=`ls -l $ZEROFILE | awk -F' ' '{print $5}'` if [ $TEMP -eq '0' ]; then echo Empty file detected: ls -l --color=auto /usr/X11R6/lib/X11/xkb/xkbcomp echo Removing the file. rm $ZEROFILE echo Adding the symlink: ln -s $TARGETFILE $ZEROFILE else echo Non-empty $ZEROFILE detected. Aborting. fi ls -l --color=auto $ZEROFILE ls -l --color=auto $TARGETFILE