I need to have access to the current date (or time) while waiting for the script so that I can add it to the directories created while waiting for the script, for example. something like this needs to be done
mkdir file<date>
I can meet through the shell as
date | tr " " "-" | cut -f 2,4 -d "-"
However, I cannot access it while waiting, for example. can't do something like
set var = `date | tr " " "-" | cut -f 2,4 -d "-"`
I put this in a shell script and then echo it and get the output in $expect_out(buffer) as verbose here . However, the buffer also receives an invitation that must be deleted as indicated. Also note that $expect_out(buffer) does not really support what people want; it usually needs to be filtered out, at least to eliminate the prompt.
source share