copy - copiar para a área de transferência
Copia para a área de trabalho (clipboard) os parâmetros enviados ao script ou os lê via STDIN.
Exemplos:
./copy string
./copy <ENTER> this is a string <^d>
./copy < string
./copy < filepath
Exemplos:
./copy string
./copy <ENTER> this is a string <^d>
./copy < string
./copy < filepath
Descrição
Copia para a área de trabalho (clipboard) os parâmetros enviados ao script ou os lê via STDIN.
Exemplos:
./copy string
./copy <ENTER> this is a string <^d>
./copy < string
./copy < filepath
Exemplos:
./copy string
./copy <ENTER> this is a string <^d>
./copy < string
./copy < filepath
#!/bin/sh # # if no args are given it reads stdin for input # redirection can be used to read from another process or via pipe # there is no need to quote as it takes all args # # examples: # copy string # copy <Return>, this is a string <^d> # copy < string # copy < filepath # # depends: xsel if test -n "$1"; then printf "%s" "$*" | xsel -bi exit $? fi printf "%s" "$(cat)" | xsel -bi