Skip to content

Instantly share code, notes, and snippets.

@tonytonyjan
Last active August 29, 2024 08:52
Show Gist options
  • Save tonytonyjan/872126cb231af0a3e17b to your computer and use it in GitHub Desktop.
Save tonytonyjan/872126cb231af0a3e17b to your computer and use it in GitHub Desktop.
PTT 每天自動登入 / PTT automatically login
#!/usr/local/bin/expect -f
set timeout 60
log_file -noappend $env(HOME)/log/ptt.log
spawn ssh -o "StrictHostKeyChecking no" [email protected]
expect "new"
send "$env(PTT_ID)\r"
expect ":"
send "$env(PTT_PWD)\r"
expect {
"您想刪除其他重複登入的連線嗎" {
send "n\r"
exp_continue
}
"請按任意鍵繼續" {
send "\r"
exp_continue
}
"批踢踢實業坊" {
exit
}
}
6 6 * * * LC_ALL=zh_TW.Big5 PTT_ID=ID PTT_PWD=PWD PATH/TO/ptt.tcl
@jacky84727
Copy link

想請問這個要怎麼使用?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment