1
#!/usr/bin/expect -f
set arguments [lrange $argv 2 end]
expect "hello"
send "$arguments\r\n"
嘗試將雙引號作爲參數傳遞給腳本。以上未按預期工作。想要通過雙引號作爲參數
我如何調用腳本是
./ExpectScript.sh \" 1 \" 2 3 4
輸出是
hello
{"} 2 3 4
預計產量
hello
" 2 3 4
雙引號對'Tcl'特殊。嘗試使用單引號並將其轉義。 './ExpectScript.sh \'1 \'2 3 4' – Dinesh
感謝您的回答。它返回:3 4.我的期望是在輸出中看到雙配額,如:「2 3 4 –