올바른 tmux 찾기 키를 사용자 정의 소켓 및 세션 구문으로 보냅니다.

올바른 tmux 찾기 키를 사용자 정의 소켓 및 세션 구문으로 보냅니다.

나는 보내기 키 인수의 구문을 올바르게 얻으려고 시도했으며 매뉴얼 페이지에서 몇 가지 변형을 시도했지만 단순히 뭔가를 오해하고 있는 것 같습니다.

다음과 같은 방식으로 tmux를 초기화하고 아래와 같이 조작하고 싶습니다.

sudo -H -u username1 -g usergroup1 bash -c '/usr/bin/tmux -S /home/shares/tmux_sessions/sock_file new -d -s "sess-tv0-i" mycommand -arg1 -arg2'
sudo -H -u username1 -g usergroup1 bash -c '/usr/bin/tmux -S /home/shares/tmux_sessions/sock_file new -d -s "sess-tv1-i" mycommand -arg1 -arg2'
sudo -H -u username1 -g usergroup1 bash -c '/usr/bin/tmux -S /home/shares/tmux_sessions/sock_file new -d -s "sess-tv2-i" mycommand -arg1 -arg2'

개별 세션에 키를 보내려고 하지만 아래 명령이 원하지 않는 모든 세션에 명령을 보내는 것 같습니다. 한 번에 하나의 세션에만 키를 보내고 싶습니다.

tmux -S /home/shares/tmux_sessions/sock_file send-keys C-c -t sess-tv0-i

위 명령을 사용하면 오류가 발생하지 않지만 명시된 대로 해당 키 문자열을 해당 소켓의 여러 세션으로 보냅니다.

나는 또한 아래에서 실패로 다음을 시도했습니다.

tmux -S /home/shares/tmux_sessions/sock_file target-session -t sess-tv0-i send-keys C-c
unknown command: target-session

tmux target-session -t sess-tv0-i send-keys C-c
error connecting to /tmp/tmux-0/default (No such file or directory)

tmux -S /home/shares/tmux_sessions/sock_file -t sess-tv0-i send-keys C-c
tmux: unknown option -- t
usage: tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name]
            [-S socket-path] [command [flags]]

조언을 해주시거나 올바른 방향을 알려주셔서 감사합니다.

답변1

명백한 오류가 사용 중이었습니다.

tmux -S /home/shares/tmux_sessions/sock_file send-keys C-c -t sess-tv0-i

사용하는 대신 해당 양말 파일의 모든 세션에 Cc 또는 Control+c 키를 보냅니다.

tmux -S /home/shares/tmux_sessions/sock_file send-keys -t sess-tv0-i C-c

-t 플래그를 적절하게 평가할 수 있습니다.

관련 정보