added xtermmaker.sh (Version 3.1)
Opens a given number of colored xterms (I became very famous by this script). Version 3.1 is a major rewrite of the Version 2.1. The versions till 2.1 were not in cvs.
This commit is contained in:
132
xtermmaker.sh
Executable file
132
xtermmaker.sh
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/bin/bash
|
||||
# LOC ~/scripts/xtermmaker.sh
|
||||
# CVS $Id: xtermmaker.sh,v 1.1 2001/07/13 14:35:28 heinzel Exp $
|
||||
version='xtermmaker.sh Version 3.1 $Revision: 1.1 $ ($Date: 2001/07/13 14:35:28 $ $Author: heinzel $)'
|
||||
|
||||
### config ###
|
||||
xterm=xterm
|
||||
xterm_opts="-sb -sl 1024"
|
||||
|
||||
number=1
|
||||
max_number=9
|
||||
|
||||
rsh=ssh
|
||||
host=""
|
||||
user=""
|
||||
|
||||
color=BUNT
|
||||
theme=light
|
||||
themes="traditional, light"
|
||||
|
||||
# Note: Themes must have $max_number colors defined
|
||||
theme_traditional="SteelBlue,SeaGreen,orange,gold,tomato,CadetBlue,SlateGrey,MediumSeaGreen,Goldenrod"
|
||||
|
||||
theme_light="SlateGrey,MediumSeaGreen,Goldenrod,IndianRed,CadetBlue,MediumSeaGreen,Goldenrod,SlateGrey,IndianRed"
|
||||
|
||||
### functions ###
|
||||
show_version()
|
||||
{
|
||||
echo $version
|
||||
}
|
||||
|
||||
show_help()
|
||||
{
|
||||
echo "Usage: xtermmaker.sh [-n <int>] [-u <user>] [-r <host>]"
|
||||
echo " [-c <color>] [-g] [-b] [--t <theme>]"
|
||||
echo " [-h|--help] [-V|--version]"
|
||||
echo ""
|
||||
echo "-n opens <int> xterms (default: $number) (max: $max_number)"
|
||||
echo ""
|
||||
echo "-r exec remote shell to the specified hostname"
|
||||
echo "-u specified the username for the remote host"
|
||||
echo ""
|
||||
echo "-c set the backgroundcolor of the xterms"
|
||||
echo "-g same as -c Gray"
|
||||
echo "-b generates \"Bunte XTerms\" (default)"
|
||||
echo "-t use color theme <theme> for \"Bunte XTerms\""
|
||||
echo " possible themes: $themes (default: $theme)"
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
||||
### argv ###
|
||||
|
||||
# read arguments from stdin
|
||||
while test $# -gt 0 ; do
|
||||
case "$1" in
|
||||
-h|-help|--help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-V|-version|--version)
|
||||
show_version
|
||||
exit 0
|
||||
;;
|
||||
-n|-number|--number)
|
||||
number="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-c|-color|--color)
|
||||
color="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-g)
|
||||
color=Gray
|
||||
shift
|
||||
;;
|
||||
-b)
|
||||
color=BUNT
|
||||
shift
|
||||
;;
|
||||
-t|-theme|--theme)
|
||||
theme="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-u|-user|--user)
|
||||
user="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-r|-host|--host)
|
||||
host="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
### action ###
|
||||
|
||||
test "$number" || number=1
|
||||
|
||||
count=1
|
||||
until test $count -gt $number ; do
|
||||
|
||||
title_opt="-title $count"
|
||||
|
||||
if test "$color" = "BUNT" ; then
|
||||
eval colors=\$theme_$theme
|
||||
bg_opt="-bg `echo $colors | cut -f $count -d ,`"
|
||||
else
|
||||
bg_opt="-bg $color"
|
||||
fi
|
||||
|
||||
fg_opt="-fg black"
|
||||
|
||||
pos_opt=""
|
||||
|
||||
if test "$host" ; then
|
||||
t=$host
|
||||
test "$user" && t="${user}@${host}"
|
||||
exec_opt="-e $rsh $t"
|
||||
fi
|
||||
|
||||
$xterm $xterm_opts $title_opt $bg_opt $fg_opt $pos_opt $exec_opt &
|
||||
|
||||
count=`expr $count + 1`
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user