#!/bin/bash ##echo "argument: $1" ## searches for an already running instance of $1 of user $USER RESULT=`/bin/ps xauwww | /bin/grep -v "$0" | /bin/grep "^$USER.*$1$"` if [ -z "$RESULT" ] ; then ## I prefer english messages to (bad) german ones: LC_MESSAGES=en_US $* else echo "Sorry, already running as:" echo " $RESULT" ## Here, notify the user with some external tools like 'beep' (just plays a wav-file) ... #beep ## ... and/or use festival (a speech synthesizer) to generate a message: echo "singleton reports that $1 is already started" | /usr/bin/festival --tts fi #end