Changing the prompt in telnet
- by wim
With some help from people on here, I was able to set a custom prompt in an ssh session (thanks!). Now I need to do the same in telnet, but I'm not sure of what syntax I could use for that.
Basically the telnet prompt is just a > character, I need to modify it to something I can more reliably detect in automation jobs. Hope this makes sense.
From inside telnet, trying to escape that command with a bang like !PS1=spam and !PS2=eggs did not change it.
wim@wim-acer:~$ ssh [email protected] -i ~/.ssh/guest_nopassphrase -t "export PS1='Sending a custom prompt \w \$ '; exec sh"
Sending a custom prompt ~ $ set
HOME='/var/tmp'
IFS='
'
LOGNAME='guest'
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
PPID='1128'
PS1='Sending a custom prompt \w $ '
PS2='> '
PS4='+ '
PWD=''
SHELL='/bin/sh'
TERM='xterm'
USER='guest'
Sending a custom prompt ~ $ telnet localhost <snip>
Entering character mode
Escape character is '^]'.
> !set
CONSOLE='/dev/ttyp0'
HOME='/var/tmp'
IFS='
'
LOGNAME='root'
PATH='/sbin:/bin:/usr/sbin:/usr/bin'
PPID='546'
PREVLEVEL='N'
PS1='\w \$ '
PS2='> '
PS4='+ '
PWD='/var/tmp'
RESPAWN_COUNT='1'
RESPAWN_LAST='0'
RESPAWN_MAX='5'
RESPAWN_TIME='5'
ROOTDEV='/dev/sla1'
RUNLEVEL='5'
SHELL='/bin/false'
TERM='linux'
USER='root'
>
> Connection closed by foreign host
Sending a custom prompt ~ $ Connection to 192.168.1.124 closed.
wim@wim-acer:~$