Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
リモート ホストに SSH 接続し、そのリモート ホストで特定のコマンドを実行して終了するスクリプトを作成する必要があります。私がするだけなら
ssh $host #some command
スクリプトは SSH で接続し、手動で終了するまで待ってから、コマンドを実行します。
これらのコマンドをリモート ホストで実行するにはどうすればよいですか?
ssh $host 'command1; command2; command3'
または、コマンドが 1 つしかない場合:
ssh $host command1
または、多くのコマンド (スクリプト ファイル) がある場合:
cat file | ssh $host sh