For a little customizability:
printf "${CMD} %s ${ARG2}\n" `xsel` | sh -n
You can remove the -noexecute flag after you've seen how it works.
If it works for you, you can drop sh entirely and do this instead:
. <<HERE /dev/stdin
$(printf "${CMD} %s ${ARG2}\n" `xsel`)
HERE
Either way is easy and will do it.Or faster:
printf "${CMD} %s ${ARG2}\n" `xsel` | . /dev/stdin
Or even:Either way is easy and will do it.