Problem on Terminal.app after opening shell script

Mac OS X 平台上程式設計的相關問題討論

版主: bryanchangdigdog謝孟叡

回覆文章
內容
發表人
頭像
謝孟叡
討論區管理員
文章: 960
註冊時間: 05/01/2001 1:01 am
來自: 邪教組織 #osxchat
聯繫:

Problem on Terminal.app after opening shell script

#1 文章 謝孟叡 »

用 Terminal.app 開 shell script 之後如果 shell script 說 exit, Terminal.app 也只停在 "Process Completed" 就停在那裡, 要怎麼樣自動把這個空殼關掉啊?
頭像
digdog
討論區管理員
文章: 1297
註冊時間: 05/02/2001 1:01 am
聯繫:

Problem on Terminal.app after opening shell script

#2 文章 digdog »

Maybe...?

圖檔
頭像
謝孟叡
討論區管理員
文章: 960
註冊時間: 05/01/2001 1:01 am
來自: 邪教組織 #osxchat
聯繫:

Problem on Terminal.app after opening shell script

#3 文章 謝孟叡 »

<BLOCKQUOTE><font size="1" face="XYZ">quote:</font><HR>原始發信人 爛狗:
<STRONG>Maybe...?</STRONG><HR></BLOCKQUOTE>

試過了, 一般 shell 使用上沒問題, 開 *.command 就是這樣
圖檔

[ 11-27-2002: 留言編輯者: 永野大神 ]
頭像
digdog
討論區管理員
文章: 1297
註冊時間: 05/02/2001 1:01 am
聯繫:

Problem on Terminal.app after opening shell script

#4 文章 digdog »

<BLOCKQUOTE><font size="1" face="XYZ">quote:</font><HR>原始發信人 永野大神:
<STRONG>試過了, 一般 shell 使用上沒問題, 開 *.command 就是這樣</STRONG><HR></BLOCKQUOTE>

嗯,跑 .command 時,Terminal 會設成 don't close this window...
頭像
謝孟叡
討論區管理員
文章: 960
註冊時間: 05/01/2001 1:01 am
來自: 邪教組織 #osxchat
聯繫:

Problem on Terminal.app after opening shell script

#5 文章 謝孟叡 »

After talked to digdog on iChat...

1. osascript -l AppleScript -e 'tell Application "Terminal" to close every window whose contents contains "Process completed"'
2. osascript -l AppleScript -e 'tell Application "Terminal" to close window 1'

是可行的方法
留言五百如一日
文章: 610
註冊時間: 12/25/2001 1:01 am

Problem on Terminal.app after opening shell script

#6 文章 »

但有 dialog sheet 下滑,要選 terminate。

訊息:

Close window

Closing this window will terminate the following processes inside it: login, tcsh, osascript

考慮 kill terminal 嗎?
頭像
謝孟叡
討論區管理員
文章: 960
註冊時間: 05/01/2001 1:01 am
來自: 邪教組織 #osxchat
聯繫:

Problem on Terminal.app after opening shell script

#7 文章 謝孟叡 »

<BLOCKQUOTE><font size="1" face="XYZ">quote:</font><HR>原始發信人 悲:
<STRONG>但有 dialog sheet 下滑,要選 terminate。

訊息:

Close window

Closing this window will terminate the following processes inside it: login, tcsh, osascript

考慮 kill terminal 嗎?</STRONG><HR></BLOCKQUOTE>

if you didn't launch that applescript in terminal.app, that shouldn't happen.
留言五百如一日
文章: 610
註冊時間: 12/25/2001 1:01 am

Problem on Terminal.app after opening shell script

#8 文章 »

<BLOCKQUOTE><font size="1" face="XYZ">quote
if you didn't launch that applescript in terminal.app, that shouldn't happen.


不用 Terminal.app 執行 osascript 此 shell command,少許難度。

小弟詮釋原問題為 "在 Terminal 的視窗中輸入 exit 的指令,可否 logout 及同時自動關閉此視窗?"

有點混淆。
頭像
謝孟叡
討論區管理員
文章: 960
註冊時間: 05/01/2001 1:01 am
來自: 邪教組織 #osxchat
聯繫:

Problem on Terminal.app after opening shell script

#9 文章 謝孟叡 »

<BLOCKQUOTE><font size="1" face="XYZ">quote:</font><HR>原始發信人 悲:
<STRONG>
小弟詮釋原問題為 "在 Terminal 的視窗中輸入 exit 的指令,可否 logout 及同時自動關閉此視窗?"
有點混淆。</STRONG><HR></BLOCKQUOTE>

Sorry, I didn't clarify the problem very well. The scenario is if you open a file *.command (no matter whether you used Terminal.app or Finder to open it), you will launch Terminal.app and your shell to parse the *.command file. Then, if your command script finished, then terminal window won't close automatically. (see the picture I post in previous article.)
留言五百如一日
文章: 610
註冊時間: 12/25/2001 1:01 am

Problem on Terminal.app after opening shell script

#10 文章 »

明白了:)
回覆文章