about summary refs log tree commit diff
path: root/tq
blob: 88c6d87d715389251d111515f13373022199b285 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
# tq CMD... - tmux wrapper for nq to display output in new window

set -e

s=$(nq "$@")
p=${s##*.}

printf '%s\n' "$s"

if [ -n "$p" ] && [ -n "$TMUX" ]; then
        tmux new-window -a -d -n '<' -c '#{pane_current_path}' \
                "trap true INT QUIT TERM EXIT;
                 tail -F --pid=$p $s || kill $p;
                 printf '[%d exited, ^D to exit.]\n' $p;
                 cat >/dev/null"
fi