Advertisement
orglee

tmux pipe-pane

Oct 19th, 2014
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/bin/bash
  2. session="test"
  3. logfile="${HOME}/tmux-$(date +'%Y.%m.%d-%H.%m')-METHOD-"
  4.  
  5. echo "LOG FILE: ${logfile}"
  6.  
  7. #if [ -e $logfile ]; then
  8. #       rm $logfile
  9. #fi
  10.  
  11. tmux new-session -d -s $session
  12.  
  13. function senddata {
  14.         tmux send-keys -t ${session} "echo TEST ${1}.1" C-m
  15.         tmux send -t ${session} "echo TEST ${1}.2" ENTER
  16. }
  17.  
  18. # METHOD A
  19. tmux pipe-pane -o -t ${session} "cat > ${logfile}A.log"
  20. senddata A
  21.  
  22. # METHOD B
  23. tmux send -t ${session} "tmux pipe-pane -o -t ${session} 'cat > ${logfile}B.log'" ENTER
  24. senddata B
  25.  
  26. # METHOD C
  27. tmux send-keys -t ${session} "tmux pipe-pane -o -t ${session} 'cat > ${logfile}C.log'" C-m
  28. senddata C
  29.  
  30. echo "LISTING LOGS"
  31. ls "${logfile}*"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement