0

Let's say I run inxi -C and want to output both inxi -C and the result of that command (CPU information) to pastebin. How do I do this in the most efficient way?

2
  • Copy paste isn't a valuable solution ?
    – Carpette
    Commented Mar 31, 2017 at 16:12
  • Sometimes that's not fast enough for me. Commented Mar 31, 2017 at 17:15

1 Answer 1

1

Why, you can do that with the handy new forexample program (docs, unit tests) assuming the command to be run is something spawn can handle; otherwise, you'd need to write this tool directly in the shell itself.

$ CLIPBOARD=cat forexample echo hi
    $ echo hi
    hi
    $ 
$ 

By default CLIPBOARD is pbcopy so either change the code or once forexample is properly setup in PATH (and expect installed) try something like

CLIPBOARD='xclip -in' forexample inxi -C
5
  • That looks like what I'm looking for. How do I install this? Commented Mar 31, 2017 at 17:22
  • 1
    It's a TCL script so install the expect package and then chmod +x this script and stash it somewhere in $PATH.
    – thrig
    Commented Mar 31, 2017 at 17:54
  • Am I missing something here? tung@tung-Lenovo-Y50-70 ~ $ gather cat gather couldn't execute "pbcopy": no such file or directory while executing "open "| pbcopy" w" invoked from within "set clippyfh [open "| pbcopy" w]" (file "/usr/bin/gather" line 16) Commented Mar 31, 2017 at 23:35
  • @BananaLeafCat that line has a comment right above it saying FIXME as copy-paste programs are unportable...
    – thrig
    Commented Apr 1, 2017 at 14:06
  • I think i have xclip but I don't know how to fix it accordingly... Could you give me an example? Commented Apr 1, 2017 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .