Re: [問題] shellscript內指定shell參數(octave)
這個問題讓我想起以前在學怎麼使用 TCL 所看到的範例
#!/bin/bash
# \
exec expect -f "$0" "$@"
…… 接下來就是一般的 expect script
明明就是 expect script
但是第一行卻不是 #!/usr/bin/expect -f
這個 script 會被當做 bash script 執行
第二行會被 bash 認為是註解
第三行把 bash 替換成 expect 重新讀進整個 script
第四行之後不會被 bash 執行
這時以 expect 執行同一個 script
第二行會被 expect 認為是註解,
而且行尾的 \ 會使得第三行被認為是第二行的連續行,
如果沒有這個花招,第三行在 expect 是 syntax error
第四行之後就是一般的 expect script
這個 # \ 似乎是 TCL 獨門技
並不能套用在 octave 上面
看來只好拆成兩個檔案
檔案一 "YourCGI"
#!/bin/bash
exec /usr/bin/octave -q "YourScript"
檔案二 "YourScript"
真正的 script 寫在這裡面
--
A quotation from the movie "The Se7en":
Ernest Hemingway once wrote that,
"The world is a fine place and worth fighting for."
I agree with the second part.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.3.168
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1447004264.A.3D7.html
推
11/13 18:47, , 1F
11/13 18:47, 1F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 4 篇):