0
我想建立一個腳本來建立預期的命令與該腳本內聯運行,基於我從別處拉出的數據。回聲輸出格式不正確
我需要的輸出看起來像這樣
send "get filename1.out.dat.pgp\n"
expect "sftp>"
send "get filename2.out.dat.pgp\n"
expect "sftp>"
我使用下面的代碼
while read filel
do
echo 'send "get '${filel}'\n"' >> $ExpectCMMDSGET
echo 'expect "sftp>"' >> $ExpectCMMDSGET
done < "$DirList"
但是當我的貓出該文件我得到
\n"d "get filename1.out.dat.pgp
expect "sftp>"
\n"d "get filename2.out.dat.pgp
expect "sftp>"
當我看看VI我得到
send "get filename1.out.dat.pgp^M\n"
expect "sftp>"
send "get filename2.out.dat.pgp^M\n"
expect "sftp>"
我曾嘗試使用sed刪除^ M一旦文件被創建之前使用,但它不工作。
任何建議
哈哈,當然我沒有想到這一點。我非常專注於輸出。感謝它的魅力 – camarokris