Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange characters

Status
Not open for further replies.

revilord

Programmer
Oct 2, 2003
64
I am moving a bunch of scripts from a Sequent system to a SCO Unix system. However the scripts don't work on the SCO UNIX so I need to fix them. The scripts are menu items that control a program on the SCO. I am having problems with some characters like '^(B^[1;1H'. I believe they are some sort of escape sequences used for graphic formating but I don't know what they are so I can't look up any refernce for them. Here is a sample. Can someone tell me what they are and what I need to look at to try and fix them.

#!/bin/csh
#
# code removed
BEGIN:
tput clear
echo -n '^(B^[1;1H'
echo -n " Main Menu"
echo -n '^(0^[2;1H'
echo -n "lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"
echo -n '^(0^[3;1Hx^[3;79Hx'
echo -n '^(0^[4;1Hx^[4;79Hx'
echo -n '^(B^[4;32H'
echo -n "1 - Project Work"
echo -n '^(0^[5;1Hx^[5;79Hx'
echo -n '^(0^[6;1Hx^[6;79Hx'
echo -n "^(B^[6;9H"
echo -n "2 - Preference Setup 3 - Setup Utility"
echo -n '^(0^[7;1Hx^[7;79Hx'
echo -n '^(0^[8;1Hx^[8;79Hx'
echo -n '^(0^[9;1Htqqqqqqqqqqqqqqqqqk^[9;79Hx'
echo -n "^(B^[9;32H q - Quit Menu"
echo -n '^(0^[10;1Hx x^[10;79Hx'
echo -n '^(0^[11;1H'
echo -n "mqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"
echo -n "^(B^[10;2H^[7mEnter Choice :^[0m "
set CHOICE=$<
#echo -n "^[12;1H "
switch ($CHOICE)
# code continues


Instead of getting a nice square box with menu items inside it I get numerous garbage characters around the edges of the menu and an Undefined variable error.
 
You have to know the terminal type used on the Sequent box and decipher its termcap and/or terminfo definition.
The obviously stuff:
^(0 Start alternate character set (semigraphic mode)
^(B Start primary char set
^[l;cH Position cursor line l, column c

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks, that is atleast giving me direction. I am looking at termcap and there are a few hundred settings. If I copy the correct settings over should that help my scripts work? If so how do I know which one's to use?
 
If I copy the correct settings over should that help my scripts work
NO. just help understand what it does and replacing the escape sequences by the appropriate tput commands.
how do I know which one's to use
As I said previously, this script is hard-coded for a specific terminal type. On the terminal on the Sequent box where this script run fine, take a look at the result of this command:
echo $TERM

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Your menu really doesn't look that elaborate. Why don't you just simplify it to a text menu so you don't have to worry about using the correct terminal commands?

Example:

Code:
tput clear
echo "Main Menu"
echo "----------------------------------"
echo "1 - Project Work"
echo "2 - Preference Setup"
echo "3 - Setup Utility"
echo "q - Quit Menu"
echo "----------------------------------"
echo "Enter Choice :"
set CHOICE=$<
switch ($CHOICE)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top