shellscript內指定shell參數(octave) - Linux

By Doris
at 2015-11-09T01:37
at 2015-11-09T01:37
Table of Contents
這個問題讓我想起以前在學怎麼使用 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.
--
#!/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.
--
Tags:
Linux
All Comments

By Valerie
at 2015-11-10T14:52
at 2015-11-10T14:52
Related Posts
求救!OpenSUSE 開機選單被 Windows 給吃掉了!

By Leila
at 2015-11-08T14:56
at 2015-11-08T14:56
OpenSUSE Leap 42.1 圖影縮圖和播放 samba 伺服器的影片

By Kumar
at 2015-11-08T12:21
at 2015-11-08T12:21
若出版業公司全面改裝 Linux?

By Todd Johnson
at 2015-11-07T06:40
at 2015-11-07T06:40
gcin無法在gnome-terminal下切換中文

By Eden
at 2015-11-06T21:42
at 2015-11-06T21:42
想請教大家都用什麼軟管理裝置?

By Kumar
at 2015-11-06T15:02
at 2015-11-06T15:02