SSH経由でスクリプトを実行すると、端末プロンプトを取得できません

SSH経由でスクリプトを実行すると、端末プロンプトを取得できません

ローカルで実行するとうまく機能する次のスクリプトがあります。

猫/tmp/input.sh

                echo -n ">> "
                read env
                exit;

実行すると、次のようにコマンドプロンプトが表示されます。

$/tmp/input.sh | echo "whatever"
$

今まではそんなに良くなった。 SSHを介してこのスクリプトを実行すると問題が発生します。

ssh wladmin@myhost /tmp/input.sh | echo "whatever"

This system is for the use by authorized users only. All data contained
on all systems is owned by the company and may be monitored, intercepted,
recorded, read, copied, or captured in any manner and disclosed in any
manner, by authorized company personnel. Users (authorized or unauthorized)
have no explicit or implicit expectation of privacy. Unauthorized or improper
use of this system may result in administrative, disciplinary action, civil
and criminal penalties. Use of this system by any user, authorized or
unauthorized, constitutes express consent to this monitoring, interception,
recording, reading, copying, or capturing and disclosure.

IF YOU DO NOT CONSENT, LOG OFF NOW.

##################################################################
# *** This Server is using Centrify                          *** #
# *** Remember to use your Active Directory account          *** #
# ***    password when logging in                            *** #
##################################################################

ご覧のとおり、コマンドプロンプトターミナルから制御を取得することを期待していますが、何かを$押さないと、追加Crtl + Cの入力のためのコマンドプロンプトは表示されません。

オプションを試しましたがssh -T 役に立ちませんでした。

何をすべきかを提案できますか?

ベストアンサー1

その行のスクリプトはスクリプトの入力を許可しないためecho "whatever"終了します。したがって、これは起こりません。なぜこれを行うのかはわかりませんが、とにかく進み続けます。 sshを使用すると、input.shスクリプトのみがリモートで実行され、stdoutのテキストが拒否されることを「知らない」ことができます。同じ効果を得るには、すべてをリモートで実行します(引用やエスケープなど)。echo -n ">> "read env|echo|

ssh wladmin@myhost /tmp/input.sh \| echo "whatever"

おすすめ記事