다중 선택을 위해 xclip을 사용하는 방법

다중 선택을 위해 xclip을 사용하는 방법

클립보드에 텍스트를 복사할 때,클립여러 선택 대상이 제공됩니다.

 -selection
    specify which X selection to use, options are:
    "primary" to use XA_PRIMARY (default), 
    "secondary" for XA_SECONDARY 
    "clipboard" for XA_CLIPBOARD

다중 선택을 구현하는 방법이 있나요?

나는 다음 옵션을 시도했습니다

  1. echo "Hello world" | xclip -i -selection primary -selection clipboard
  2. echo "Hello world" | xclip -i selection primary | xclip -i selection clipboard
  3. echo "Hello world" | xclip -i selection primary,clipboard

그러나 그들 중 누구도 작동하지 않습니다.

답변1

나는 다음 옵션을 시도했습니다

echo "Hello world" | xclip -i selection primary | xclip -i selection clipboard  

정말 가까워요... 첫 번째 명령을
사용하면 텍스트가 다시 인쇄됩니다.-fxclip표준 출력이를 두 번째 명령에 전달할 수 있습니다 xclip.

echo "Hello World" | xclip -i -sel p -f | xclip -i -sel c

에서 man xclip:

-f, -filter
            when xclip is invoked in the in mode with output level set to
            silent (the defaults), the filter option will cause xclip to print
            the text piped to standard in back to standard out unmodified

답변2

나는 그것을 사용하지 않기 xclip때문에 내가 모르는 기본 방법이 있을 수 있습니다. 어쨌든 쉘이 다음과 같다고 가정합니다 bash.

echo "Hello world" | tee >(xclip -i -selection primary) >(xclip -i -selection clipboard) >/dev/null

>()프로세스를 대체하는 형태입니다. bash각 파일 설명자를 괄호 안에 있는 프로그램의 표준 입력에 연결된 파일 설명자의 경로로 바꿉니다.

관련 정보