expect is not working for different language
Posted: 2020/12/26 06:03:15
I am doing Postgres database auto backup on CentOS 7.9 using expect and shell code. My code is working fine in English environment but it fails in Japanese environment. Here is my expect code
After checking the log file it is clear that expect cannot send password for "パスワード: $" keyword. I also tried 'スワー' but same result. If change my OS language from Japanese to English and replace パスワード to 'Password' the code works fine. Is there any way to work expect with a different language?
Code: Select all
#!/usr/bin/expect
set homeDirectory "/home/kds/DB_BACKUP"
set dbPassword "manager"
log_file $homeDirectory/LOG/db_backup.log;
#Execute database backup script
spawn $homeDirectory/./backupexecutor.sh
set found 0
while {$found < 1} {
expect {
"パスワード: $" {send "$dbPassword\r"}
"^Rollout Done " {set found 1}
"^Rollout Updated " {set found 1}
}
}
expect eof