home *** CD-ROM | disk | FTP | other *** search
Korn shell script | 1997-02-07 | 1.4 KB | 81 lines |
- #!/bin/ksh
- #
- # Simple script to assist "aview" with launching programs.
- # Sending all aview launch requests through this single script makes it
- # easier to add new launchable programs without requiring old arrayd.conf
- # files to be modified.
- #
-
- Usage="Usage: $0 <origin> <app> <display> [<arg>]..."
-
- #
- # Make sure enough args were specified
- #
- if [ "$#" -lt 3 ]; then
- echo "Incorrect number of arguments to $0"
- echo $Usage
- exit 1
- fi
-
- #
- # Give the arguments more meaningful names
- #
- Origin=$1
- App=$2
- Display=$3
- shift 3
-
- #
- # Set up the display to use
- #
- if [ "$Display" = ":0" -o "$Display" = ":0.0" ]; then
- if [ "$Origin" != "localhost" ]; then
- Display="$Origin:0"
- fi
- fi
-
- #
- # Determine the actual program to be launched
- #
- case $App in
- shell)
- Program="/usr/lib/array/ashell"
- ;;
-
- mpi )
- Program="/usr/lib/array/ampi"
- ;;
-
- pvm )
- Program="/usr/lib/array/apvm"
- ;;
-
- * )
- /usr/bin/X11/xconfirm -c \
- -display $Display \
- -header "ArrayView launch" \
- -icon error \
- -t "Sorry, $App is not a known application" \
- > /dev/null
- exit 1
- ;;
- esac
-
- #
- # Make sure the desired application is available
- #
- if [ ! -x $Program ]; then
- /usr/bin/X11/xconfirm -c \
- -display $Display \
- -header "Launch $App" \
- -icon error \
- -t "Sorry, the ArrayView $App launcher $Program is not available" \
- > /dev/null
- exit 1
- fi
-
- #
- # Launch the application
- #
- exec $Program $Origin $Display "$@"
-