ああ私の端末では、いくつかのコマンドを実行し、別のタブを開き、特定のディレクトリにcdし、自分のローカルのサーバを起動し、sshをリモートサーバに起動する。mac auto terminalコマンド?
これを自動的に行うにはどうすればよいですか?
ありがとうございます。
ああ私の端末では、いくつかのコマンドを実行し、別のタブを開き、特定のディレクトリにcdし、自分のローカルのサーバを起動し、sshをリモートサーバに起動する。mac auto terminalコマンド?
これを自動的に行うにはどうすればよいですか?
ありがとうございます。
すべてのことを行うシェルスクリプトを作成できます。また、SSHサーバーにログオンするときに手動でパスワードを入力したくない場合は、パスワードを必要としない認証キーとしてリモートサーバーにキーを置くことができます(正しく設定されている場合)。
This pageは、AppleScriptを使用して端末を開いたり、フォーカスを合わせたり、タブを4つ開いたりする方法を示しています。目的に合わせて変更できます。
次のAppleScriptは、ターミナルを起動させる新しいタブを作成し、2つ目のタブに「your_command」(あなたが欲しいものを行うスクリプト)を実行します。
on menu_click(mList)
local appName, topMenu, r
-- Validate our input
if mList's length < 3 then error "Menu list is not long enough"
-- Set these variables for clarity and brevity later on
set {appName, topMenu} to (items 1 through 2 of mList)
set r to (items 3 through (mList's length) of mList)
-- This overly-long line calls the menu_recurse function with
-- two arguments: r, and a reference to the top-level menu
tell application "System Events" to my menu_click_recurse(r, ((process appName)'s (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
end menu_click
on menu_click_recurse(mList, parentObject)
local f, r
-- `f` = first item, `r` = rest of items
set f to item 1 of mList
if mList's length > 1 then set r to (items 2 through (mList's length) of mList)
-- either actually click the menu item, or recurse again
tell application "System Events"
if mList's length is 1 then
click parentObject's menu item f
else
my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
end if
end tell
end menu_click_recurse
tell application "Terminal"
activate
my menu_click({"Terminal", "Shell", "New Tab", "Pro"})
set window_id to id of first window whose frontmost is true
do script "your_command" in tab 2 of window id window_id of application "Terminal"
end tell
はTerminitorを見てください。フォーカスはプロジェクトごとの端末を設定することですが、configは1つのファイルに保存して自由に実行できます。
@netrom
で述べたように、これはあなたの〜/ .bashrcのファイルにコマンドを追加し、それはあなたが、端末を起動するたびにrunnedされていることを確認し、AppleScriptをのための+1を役立つことを証明していない場合:
環境設定>シェル>スタートアップ>マーク:コマンドを実行し、次のように入力します。source〜/ bashrc