Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

303
Vistas
Avoid "enter" when pasting xsel / xclip

This is somewhat simple, I presume, but still I cannot figure out how to do it. I have the following function defined:

date +%Y-%m-%d_%H:%M | xclip -selection c

which gets a timestamp and puts it into the clipboard. I mainly want to use this to name files, so I can, for example, go

vi file_2016-02-16_20:10_somemorethings.txt

but when I paste the date in the terminal (with control+shift+V) it already enters the command, so I never get the chance to type _somemorethings.txt. In other words, the last character that xclip saves is the Enter key. This happens everytime I pipe something to xclip or xsel, not only with the function defined above.

I know this sounds like something unimportant, but it would really improve productivity is this little issue could be fixed.

I have tried several options with both xclip and xsel and nothing seems to overcome this. Any ideas? Is this even possible?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You could use tr, for example

date +%Y-%m-%d_%H:%M | tr -d '\n' | xclip -selection c 

See this question for different ways to achieve it: Bash: Strip trailing linebreak from output

over 4 years ago · Santiago Trujillo Denunciar

0

Just a note for anyone who comes here in the future, the command

date +%Y-%m-%d_%H:%M | xclip -rmlastnl -selection c 

will do the job now.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda