Skip to main content
added 4 characters in body
Source Link
mikeserv
  • 59.4k
  • 10
  • 123
  • 244

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.

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.

printf "${CMD} %s ${ARG2}\n" `xsel` | . /dev/stdin

Or even:

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

Or faster:

printf "${CMD} %s ${ARG2}\n" `xsel` | . /dev/stdin

Either way is easy and will do it.

added 53 characters in body; added 1 characters in body; deleted 1 characters in body; added 67 characters in body
Source Link
mikeserv
  • 59.4k
  • 10
  • 123
  • 244

For a little customizability:

singlequote="${sq="$(printf \\047)""${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 "sh -cn ${sq}$"${CMD} %s ${ARG2}${sq}\n" `xsel` )
HERE

You can remove the sh -command -noexecute 'single 'single after you've seen howEither way is easy and will do it works.

printf "${CMD} %s ${ARG2}\n" `xsel` | . /dev/stdin

That will do it.Or even:

For a little customizability:

singlequote="${sq="$(printf \\047)"}"
. <<HERE /dev/stdin
    $(printf "sh -cn ${sq}${CMD} %s ${ARG2}${sq}\n" `xsel` )
HERE

You can remove the sh -command -noexecute 'single 'single after you've seen how it works.

That will do it.

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.

printf "${CMD} %s ${ARG2}\n" `xsel` | . /dev/stdin

Or even:

added 4 characters in body
Source Link
mikeserv
  • 59.4k
  • 10
  • 123
  • 244

For a little customizability:

singleq="$singlequote="${sq="$(printf \\047)"}"
. <<HERE /dev/stdin
    $(printf "sh -cn ${singleqsq}$CMD${CMD} %s ${ARG2}${singleqsq}\n" `xsel` )
HERE

You can remove the sh -command -noexecute 'single 'single after you've seen how it works.

That will do it.

For a little customizability:

singleq="$(printf \\047)"
. <<HERE /dev/stdin
    $(printf "sh -cn ${singleq}$CMD %s ${ARG2}${singleq}\n" `xsel` )
HERE

You can remove the sh -command -noexecute 'single 'single after you've seen how it works.

That will do it.

For a little customizability:

singlequote="${sq="$(printf \\047)"}"
. <<HERE /dev/stdin
    $(printf "sh -cn ${sq}${CMD} %s ${ARG2}${sq}\n" `xsel` )
HERE

You can remove the sh -command -noexecute 'single 'single after you've seen how it works.

That will do it.

added 155 characters in body
Source Link
mikeserv
  • 59.4k
  • 10
  • 123
  • 244
Loading
Source Link
mikeserv
  • 59.4k
  • 10
  • 123
  • 244
Loading