#!/bin/bash
# echo "Can also be started with cluster name as first and only parameter on command line."
# Username to use on servers:
loginuser=martin
# For some fancy text:
und=`tput smul`
bold=`tput bold`
norm=`tput sgr0`
# Here we go:
if [ -z "$1" ]; then
grep clusters ~/.csshrc
read -p "Cluster to connect to (or 'list ${bold}clustername${norm}' or 'list all'): " connectto listit
while [ $connectto = "list" ]
do
if [ $listit = "all" ]; then
grep -v "clusters =" ~/.csshrc
read -p "Cluster to connect to (or 'list ${bold}clustername${norm}' or 'list all'): " connectt$
else
grep "^$listit " ~/.csshrc
read -p "Cluster to connect to (or 'list ${bold}clustername${norm}' or 'list all'): " connectt$
fi
done
echo "Connecting to cluster ${und}$connectto${norm} as ${und}$loginuser${norm}"
csshX -screen 2 -l $loginuser $connectto
else
echo "Connecting to cluster ${und}$1${norm} as ${und}$loginuser${norm}"
csshX -screen 2 -l $loginuser $1
fi