3
在這個特定的腳本中,他們使用\n
。 n和 r之間的區別是什麼?
#!/usr/bin/expect
set password [lindex $argv 0]
spawn asadmin enable-secure-admin
expect "admin"
send "admin\n"
expect "password"
send "$password\n"
expect eof
exit
問題
能\r
一樣好已經使用?如果不是,有什麼區別?
只需添加到Kenster的偉大答案,維基百科在[newline](http://en.wikipedia.org/wiki/Newline)/ EOL約定及其背後的歷史上有一篇很好的文章。請注意,一些Internet協議更喜歡EOL的'\ r \ n'組合,儘管大多數軟件都會處理普通的'\ n',而使用這種協議的庫例程可能會自動將本地EOL轉換爲正確的順序。 – 2014-10-04 07:28:37