Have a Question?
Print

00190: Unix shell script to automatically assign unique FID(0)’s to Facetterm sessions

Title:

Unix shell script to automatically assign unique FID(0)’s to Facetterm sessions

Description:

The following illustrates one way to use a table lookup to set the terminal ID for BBx when running in a FacetTerm window. To implement the example on your system, do the following: 

1. Create a file called “setbbterm” like the example shell script (see below). Put it in any directory where you keep local script files, or in /etc. 

2. Call setbbterm from your .profile by adding the command “. /etc/setbbterm” after FacetTerm starts but before the call to BBx. If you do not start FacetTerm or BBx from your .profile, add the “. /etc/setbbterm” command to a script that you use to call your BBx program. 

3. Create the file /etc/setbbterm.tbl like the example table (see below). It should have the BBx terminal ID (BBTERMs) in the first column, and the tty/window combination in the second column. There is a comma between the ttyname and the window number. Window number zero refers to the terminal when it is not running FacetTerm. 

4. Modify or add the terminal IDs (BBTERMs) in the config.bbx file. They should all be in there and use device name “/dev/tty”. This is the generic device that will always mean “the current window”. 

Example table: (setbbterm.tbl) 

#This is the setbbterm.tbl file for 
#BBx Terminal Designation / FacetTerm window conversion table 

#BBTERM tty window 
T0 /dev/tty4b,0 
T1 /dev/tty4b,1 
T2 /dev/tty4b,2 
T3 /dev/tty4b,3 
T4 /dev/tty5b,0 
T5 /dev/tty5b,1 
T6 /dev/tty5b,2 
T7 /dev/tty5b,3 

Example shell script: (setbbterm) 


######################################################## 

# Setbbterm sets the BBTERM variable based on the original login 
# terminal and the FacetTerm window number, if any. It should 
# be invoked using the “. setbbterm” command (so that the 
# exported BBTERM variable is available to bbx.) Then when bbx 
# is run, it will look for the alias line in the config.bbx file 
# whose TTYID matches BBTERM. 

######################################################## 

######################################################## 

# If this is not being run in a FacetTerm window, set the window 
# number to zero and the ttyname using the tty command. 
# If this is being run in a FacetTerm window, set the window 
# number to the FacetTerm window number and the ttyname to the 
# original terminal. 

######################################################### 
if fct_info not_a_window 
then 
TTY= tty 
WINDOW=0 
else 
TTY= fct_info ttyname 
WINDOW= fct_info window_number 
fi 
echo TTY=$TTY 
echo WINDOW=$WINDOW 
######################################################## 

# Now, look up the combination of ttyname, window in the file 
# and set the BBTERM variable to the first entry on that line, 
# or to TX if no entry is found that matches. 

######################################################## 
set grep $TTY,$WINDOW /etc/setbbterm.tbl XxXx 
if [ “$1” != “XxXx” ] 
then 
BBTERM=$1 
else 
BBTERM=TX 
fi 
export BBTERM 
echo “BBTERM=$BBTERM” 



Last Modified: 07/20/2000 Product: PRO/5 Operating System: Unix

BASIS structures five components of their technology into the BBx Generations.

Table of Contents
Scroll to Top