Hi Brett, Thanks for your post. I am looking for a solution to paste the output from clipboard into other command (say as additional argument to completely new command). Unfortunately I haven't found any useful information for that. Any idea how to past to contents of clipboard into command? pbpaste command works if I run it as a coprocess without any others. But when I use either run command or send text option, nothing happens. Iterm documentation doesn't say anythin about this. I was using SecureCrt earlier and it had \v switch which pastes clipboard into input, but can't find anything in iTerm2 for now. Thanks a lot in advance!
Sounds like you either want piping, e.g. pbpaste | command
or substitution, e.g. command "$(pbpaste)"
. Or is there something I'm not understanding about the question?
Thanks for you reply, Brett. command "$(pbpaste)" is what I need, but when I use a trigger with either "send text" or "run command" option, the pasteboard is not triggered. And what I get instead with "send text" option is just the following: command "$(pbpaste)" And with "run command" action I get nothing at all. I am out of ideas now :-(
Are you trying to put it on a keyboard shortcut? Why do you need "send text" or "run command" at all?
load more (1 remarks)
If you only want to delete *trailing* newlines you can change the command to:
printf '%s' "$(pbpaste)"
which uses the fact that command substitution removes any trailing newlines.
This feature is coming to readline, and so bash,[0] and with this plugin[1] is available in zsh.
[0]: http://lists.gnu.org/archiv...
[1]: https://github.com/robbyrus...