Imprimer le contenu du presse-papiers du système dans bash


Réponses:


8

Selon la page de manuel, l' -ooption de xclippousser les données dans la direction opposée:

   -i, -in
          read text into X selection from standard input or files (default)

   -o, -out
          prints the selection to standard out (generally for piping to a file or program)

Dans votre commande ci-dessus, le -iest supposé.


7

Un autre choix est le xselprogramme:

By default, this program outputs the selection without modification  if
   both  standard  input  and standard output are terminals (ttys). Other‐
   wise, the current selection is output if standard output is not a  ter‐
   minal  (tty),  and the selection is set from standard input if standard
   input is not a terminal (tty). If any input or output options are given
   then the program behaves only in the requested mode.

Donc, copiez simplement quelque chose dans le presse-papiers et exécutez-le xselpour l'imprimer sur le terminal. Vous pouvez avoir une lecture man xselpour des options plus avancées comme le presse-papiers à utiliser, etc.


5
Pour simplifier les choses ... voici ce que je fais: alias pbcopy='xsel --clipboard --input'; alias pbpaste='xsel --clipboard --output' j'ai choisi les noms pour correspondre aux commandes MacOS.
— Bananguin
En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.