[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Making X a command center



I'm about 2 months into using debian linux so I still use a lot of dos
programs. I devised this shell script that allows me to make X a command
center that can call and open full consoles with programs already loaded.
It supposedly relieves me from having to open the console, remember which
one is open and where to switch to. It's about 90% ripe. This is my first
script, so help me out a little.

====================  SCRIPT FOLLOWS =================================
# Find out what processes are ongoing
# Setup beginning virtual screen, why doesn't 10 work?, oh well.
ps >/tmp/process
myprog=$1
begnum=11

# (1) Check for command line program name
if test -z "$myprog"
then
	exit
fi

# (2) First check to see if any console programs have been run

if test ! -e /tmp/console.dat            # If console.dat doesn't exist
then
	echo $myprog $begnum > /tmp/console.dat
	open -c $begnum -s -l -- $myprog
        exit
fi

# (3) If file does exist, then check to see if our program is already
# listed in the console.dat
 
grep -hiw $myprog /tmp/console.dat > /tmp/play
mycode=$?

# (4) Nonsuccessful search, mycode =1
# Let's get the last number in the file, add 1 to it
# Add program name and new number to file
# Finally open a new virtual number

if test "$mycode" -eq 1
then
	tail -1l /tmp/console.dat > /tmp/play
        read x y < /tmp/play
        let "newnum = $y + 1"
        echo $myprog $newnum >> /tmp/console.dat      
	open -s -c $newnum -l -- $myprog   #Open Program in another virtual console
	exit
fi

# (5) If successful search, mycode = 0
# Now let's see if the program is a process on the computer
# You see, we could have erased it (Our system doesn't automaticly update
# the console.dat file)
read x y < /tmp/play               
grep -hiqw $y /tmp/process    #Search for the whole process number
process=$?
#
# If both mycode and process register exit codes of 0, we got it

if test "$mycode" -eq 0 -a "$process" -eq 0
then
        switchto $y
	exit
fi

# If just mycode shows, use the same VC and restart program
if test "$mycode" -eq 0
then
        read x y < /tmp/play
        open -s -c $y -l -- $myprog
	exit
fi
exit
========================== END OF SCRIPT =========================

Now I've got a few problems?

1) On loading Midnight Commander, function keys don't work
2) Pine, my favorite, no color (even though setterm is there), aborts
   and disappears
3) I get no login requests (so I don't know if this program), for
instance, I would prefer dosemu to be suid root.
4) Do I need to deallocate memory after quitting a file. If so, where are
the debian utils for doing so?

Any answers, suggestions, or improvements ???

Thankx
i.b.mackey



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: