0

So, I have switched to Fedora from Debian recently, and have noticed something odd in the default Fedora BASH shell.

If I run autoexpect and record commands, the following sorts of output gets generated:

# demo of the recording

autoexpect 
env > foo
Ctrl-D
# the script expect statement recording

# notice that expect recorded output prior to sending the command!

set timeout -1
spawn $env(SHELL)
match_max 100000

expect -exact "^[\]777;notify;Command completed;env > foo^[\\^[\]777;precmd^[\\^[\]0;chris@localhost:~^[\\^[\]7;file://localhost.localdomain/home/chris^[\\\[chris@localhost ~\]\$ "
send -- "env > foo\r"
expect -exact "env > foo\r
^[\]777;preexec^[\\^[\]777;notify;Command completed;env > foo^[\\^[\]777;precmd^[\\^[\]0;chris@localhost:~^[\\^[\]7;file://localhost.localdomain/home/chris^[\\\[chris@localhost ~\]\$ "

I will not see any of this what looks like multi-processing junk in a similar recording in, say, debian.

Even worse, here is a first class linux distribution, and autoexpect flat out fails to run after I record a simple macro due to this apparent shell-abstraction layer.

This seems to be due to the fact that my actions in the fedora shell are in a shell within a shell, and expect actually records the auto-generated flag response before send -- "env > foo\r" is recorded.

Further, I have shelled into a remote fedora machine where none of this occurs.

What is going on here?

6
  • Your Fedora bash prompt is different from your Debian bash prompt. Oct 8, 2020 at 13:42
  • @glennjackman sorry, I did not add everything. I am shelling from a fedora prompt to a fedora destination. In the destination install of fedora 32, there is none of that subshell activity. In my source install of fedora 32, there is. Both of them are brand new.
    – Chris
    Oct 8, 2020 at 13:47
  • So, what's in the default fedora prompt? what does declare -p PS1 PROMPT_COMMAND show? Oct 8, 2020 at 13:49
  • @glennjackman declare -- PS1="[\\u@\\h \\W]\\\$ " declare -- PROMPT_COMMAND="__vte_prompt_command"
    – Chris
    Oct 8, 2020 at 13:51
  • OK, now type __vte_prompt_command should contain that "notify" stuff. If you don't want it, unset PROMPT_COMMAND in your .bashrc. Oct 8, 2020 at 13:52

1 Answer 1

2

Your Fedora bash prompt is different from your Debian bash prompt.

You can do something like this in expect:

set prompt "$ "

spawn bash
send "unset PROMPT_COMMAND; PS1='$prompt'\r"

expect $prompt
send "env > foo\r"

expect $prompt
send "\x04"    ;# Ctrl-D
expect eof
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.