home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / arraysvcs.idb / usr / lib / array / ashell.z / ashell
Encoding:
Korn shell script  |  1997-02-07  |  919 b   |  48 lines

  1. #!/bin/ksh
  2. #
  3. # Simple script to fire up a shell window
  4. #
  5.  
  6. Usage="$0 <origin> <display> [<host>]"
  7.  
  8. #
  9. # Make sure enough args were specified
  10. #
  11. if [ $# -lt 2  -o  $# -gt 3 ]; then
  12.     echo "Incorrect number of arguments to $0"
  13.     echo $Usage
  14.     exit 1
  15. fi
  16.  
  17. #
  18. # Give the arguments more meaningful names
  19. #
  20. Origin=$1
  21. Display=$2
  22. if [ $# -eq 3 ]; then
  23.     Host=$3
  24. else
  25.     Host=$Origin
  26. fi
  27.  
  28. #
  29. # If this command is running on the origin machine (implied by Display
  30. # being ":0[.0]") but the winterm itself will be running on another machine,
  31. # the Display variable must be set as if we are a remote machine.
  32. #
  33. if [ "$Display" = ":0"  -o  "$Display" = ":0.0" ]; then
  34.     if [ X$Origin != X$Host ]; then
  35.         Display=`hostname`"."`domainname`":0"
  36.     fi
  37. fi
  38.  
  39. #
  40. # Invoke winterm on the appropriate machine
  41. #
  42. if [ X$Host = X$Origin ]; then
  43.     exec /usr/sbin/winterm -display $Display
  44. else
  45.     exec /usr/sbin/arshell $Host /usr/sbin/winterm -display $Display
  46. fi
  47.  
  48.