News for hackers. Stuff that matters.
Re:Scripting tmux by 3xblah on Saturday January 04, 2020 @12:32AM (#21953082)
This comment was posted using tmux scripting, as follows:

    set -x
    send(){ tmux send "$@";}       
    send 'links -no-connect https://news.ycombinator.com/login?goto=news' ;
    send c-m; sleep 2;
    send 3xblah c-m $HNPASSWORD c-m c-m c-m; sleep 2;
    send Escape; sleep 1; send V S; sleep 1;
    send 'scripting tmux' c-m Down Down Down Down Down Down c-m;
    send Escape; sleep 1; send V S; sleep 1;
    send 'add comment' c-m Up;
    send 'This comment was posted using tmux scripting, as follows: ' c-m; 
    a=$(sed '5,18!d' $0); sleep 2;
    send "$a"; sleep 2; send c-m c-m Down c-m;
Re:Scripting tmux by hashhar on Saturday January 04, 2020 @09:03AM (#21954929)
Is this an accidental quine? That's so cool.

[Quine]: https://en.wikipedia.org/wiki/Quine_%28computing%29

Re:Scripting tmux by atq2119 on Saturday January 04, 2020 @06:01AM (#21954209)
A tmux/HN quine, or at least something close to it. This deserves to go into some sort of hall of fame.
Re:Scripting tmux by GordonS on Saturday January 04, 2020 @06:21AM (#21954280)
Nice, I had no idea you could script tmux like that! Reminds me of "expect", which I've used to automate interactive SSH sessions with network devices.
Re:Scripting tmux by tyingq on Saturday January 04, 2020 @08:36AM (#21954824)
Replacing the sleeps with calls to "tmux capture-pane" to parse the responses would be closer to expect.
Re:Scripting tmux by 3xblah on Saturday January 04, 2020 @08:49AM (#21954867)
Brainless method I use to check the panel:

  case $1 in
  ""|-b|-E|-S|-t)
  tmux capturep $@ --;
  tmux showb $@ --;
  exec tmux dele --;
  esac
Also there is a "-N repeat count" option for send-keys in newer versions of tmux.
Re:Scripting tmux by abcdef123xyz2 on Sunday January 05, 2020 @03:26PM (#21963802)
capture-pane has -p so you can pipe its output rather than letting it create a buffer you have to delete.
Re:Scripting tmux by 3xblah on Sunday January 05, 2020 @06:14PM (#21964918)
s/has/now &/

I started using tmux in 2009. There was no -p option when capturep command was first added. Old scripts that keep working tend not to get updated. I have updated it now. Thank you.