Operating System - HP-UX
1831320 Members
3042 Online
110023 Solutions
New Discussion

Set TERM Value via Script

 
SOLVED
Go to solution
george_114
Advisor

Set TERM Value via Script

Please help me, I am newbie in Unix.
I have a case when i execute command tty on console:
$tty
/dev/tty1 or /dev/tty2 or etc

And when i execute command tty on client machine:
$tty
/dev/pts/0 or /dev/pts/1 or etc

How to make a script that can set $TERM in two conditions:
if tty=/dev/tty* then set $TERM=vt100
else set $TERM=ansi

Thanks in advance for your help.
2 REPLIES 2
Ernesto Cappello
Trusted Contributor

Re: Set TERM Value via Script

#!/bin/sh

if [ tty = "/dev/tty*" ]
then
set $TERM=vt100
else
set $TERM=ansi
fi

Regards, Ernesto.
Elmar P. Kolkman
Honored Contributor
Solution

Re: Set TERM Value via Script

Nice... 2 threads for the same problem.

The answer given won't work, because if the test done and the fact that your shell variable won't be propagated to your current shell.

A working version is in threadId=238205...
Every problem has at least one solution. Only some solutions are harder to find.