add kvpairs2td
[hband-tools.git] / user-tools / screenconsole
blob369e47b13fe5917f4603ba2a419acd32524cad61
1 #!/bin/bash
3 true <<EOF
4 =pod
6 =head1 NAME
8 screenconsole - Interactive CLI to run GNU/screen commands against current or specified screen session
10 =cut
12 EOF
14 if [ ".$1" = ".-i" ]; then
15 shift
16 while read -a cmd; do
17 [ -n "${cmd[*]}" ] && screen -S "$STY" -X "${cmd[@]}"
18 done
19 else
20 STY=${1:-$STY}
21 if [ -z "$STY" ]; then
22 echo "$0: No \$STY set. Run within an attached Screen, or run 'screenconsole <ScreenID>'." >&2
23 exit 1
25 STY=$STY exec rlwrap -S "$STY> " $0 -i