Have a Question?

00221: Unix scripts to dynamically assign a FID(0)


Unix scripts to dynamically assign a FID(0)


# @(#) SetClient Addition to /etc/profile to set environment variable 
# @(#) CLIENT to name of telnet client machine 
# @(#) Invoke as: . /usr/bin/SetClient 

tty=`who -mx |awk ‘{print $2}’|grep ttyp` 
if [ -n “$Tty” ] then 
CLIENT=`who -mx |awk ‘{print $6}’` 
echo $CLIENT else 
CLIENT=”” fi 
export CLIENT 

This script depends on 2 things. The ‘who -m’ command works. (SCO OpenServer), and there are entries for the various machines in /etc/hosts. Otherwise, who -m returns the internet address. 

Once CLIENT is set, create a table like: 
T0 Winnie 
T1 Tigger 
T2 Opus 

etc. Then do: 

set grep $CLIENT /usr/bbx/table XxXx 
if [ “$1” = “XxXx ] then 
echo “$CLIENT not found in table” else 
export BBTERM fi 

These are “bare bones”, but you get the idea. 


The above method works great, but there is also another method. This is similar to the method used with FacetTerm. Create a script that is executed just before starting BBx like this: 
. /usr/bin/ipbbterm 

/usr/pro5/pro5 —–the rest of the arguments—- 

The script: 
# /usr/bin/ipbbterm – script that sets BBTERM based on IP address and the table 
# file referenced on ‘aliases=’ line 
# table format: 
# field 1=IP address, field 2=TerminalID to use for Alias, field 3=remark 
# table fields are tab delimited 
# multiple, unique aliases are allowed for each unique IP address, being assigned on a first 
# available basis 

PSD=`tty |cut -c6-10` 
PIP=`who -x | grep $PSD |cut -c38-` 

# table file search 
aliases=`cat /usr/dsamod/aliastable|grep $PIP|cut -f 2` 

# the P=’`ps -ef|grep pro5|grep t$i’ ‘` line searches the process status report for pro5 
# if it finds a pro5 then it searches that line(s) for the letter ‘t’ followed by whatever 
# is in the variable $i followed by a space. (If $i isn’t set then it looks for ‘t’ ) 

for i in $aliases do 
P=`ps -ef|grep pro5|grep t$i’ ‘` 
if [ “$P” = “” ] 
fi done 

if [ “$BBT” = “” ] then 
echo “NO sessions available for address $PIP” 
echo “Return to exit:\c” 
read q 
exit else 
export BBTERM fi 

A sample of the ‘aliastable’ file: T10 Winnie the Pooh T11 Winnie the Pooh T12 Winnie the Pooh T18 Tigger the Tiger T19 Tigger the Tiger T20 Tigger the Tiger T4 Opus the Penguin T5 Opus the Penguin T6 Opus the Penguin 

As you see, this also allows for multiple sessions in bbx for the same workstation(IP address). 

All entries in config.bbx look like this: 
alias T0 /dev/tty term k0 
alias T1 /dev/tty term k0 

and so on. 

Last Modified: 09/28/2001 Product: PRO/5 Operating System: Unix

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

Table of Contents
Scroll to Top