Re: expect match fancy prompt



On Tue, 17 Jun 2008 20:35:26 -0400, Russell Treleaven wrote:

Hi,

I have been trying to figure out how to match the prompt described
below.
Actually I think I just want to match the from the dollar sign to the
end of the prompt.

PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '

Alternatively can anbody provide a link to a good primer on escape
sequences?

Sincerely,

russ@xxxxxxxx

I take it that this is a Linux system? If so, then a simple solution
that I have found is to remove the above altogether. Create a new shell
instance in your Expect script, then exp_send "unset PROMPT_COMMAND\r".
Once that is done, you can set PS1 to be anything you like (preferably
something like "$ ", and you won't have to deal with the escape sequences
inside the prompt.
.



Relevant Pages

  • Re: bash command substitution, functions and quoting : need help
    ... Bash has built-in notations to show date, time, hostname, current directory, ... etc. in the prompt. ... interspersed with color escape sequences and other data... ...
    (comp.unix.shell)
  • Re: bash command substitution, functions and quoting : need help
    ... once per prompt, but at twice or more per prompt the shell starts to ... The last 3 bash prompts are colored appropriately, ... escape sequences. ... I want the programinvoked by func() to be executed ONCE PER ...
    (comp.unix.shell)
  • Re: bash command substitution, functions and quoting : need help
    ... But what you probably want is to have all the programs invoked by func() ... Suppose you want to insert into the prompt the output of two different ... PS1 contains the escape sequences with embedded commands, ... Here, bash executes "date" each time and places the output in the prompt, ...
    (comp.unix.shell)
  • [opensuse] Re: bash_history
    ... character of the command line cannot be deleted. ... me like you have some escape sequences in your prompt that aren't correctly ... bracketed by the "unprinting" start & stop prompt sequences, ... Linux Brain Dump - Linux Notes, ...
    (SuSE)
  • Re: Gnome-Terminal - odd behaviour while typing
    ... remedied by escaping the chunk of text that doesn't print using \). ... I had escape sequences in the prompt for different colors... ...
    (freebsd-questions)