GNU画面のコピーモードバッファにコマンド出力を送信する方法

GNU画面のコピーモードバッファにコマンド出力を送信する方法

コマンド出力をGNU Screenのコピーモードバッファに送信する方法はありますか?次のように入力したいと思います。

$ echo 'this is an example' | screen_send_to_copy_mode

または多分

C-a Some key

その後、ボタンを押すと出力がC出ます。可能ですか?]this is an example

ベストアンサー1

次のことができます。

screen_send_to_copy_mode() (
  tmp=$(mktemp) || exit
  cat > "$tmp" &&
    screen -X readbuf "$tmp"
  ret=$?
  (sleep 2; rm -f -- "$tmp")&
  exit "$ret"
)

echo 'this is an example' | screen_send_to_copy_mode    

おすすめ記事