#!/bin/bash -e txt="$(pass "$(cat /tmp/passselect)" | sed -n '/^Username:/{s/Username:\s*//p;q}')" bak="$(xclip -o -sel c)" xclip -sel c <<< "$txt" xdotool key --clearmodifiers 'ctrl+v' xclip -sel c <<< "$txt"