Talk:Renumbering GNU Screen Windows/@comment-4.71.223.2-20120530205204

Here is mine. I bind a key to run the shell script from within screen. No pauses or temp files. Also puts you back your your current window at the end.


 * 1) !/bin/bash

screen -X msgminwait 0 screen -X msgwait 0 CURRENT_WINDOW=$( screen -Q title ) MAX_WINDOW=40   #Default compiled in let NEXT="0"
 * 1) CURRENT_WINDOW=$( screen -Q number | sed 's/.*(//' | sed 's/).*//' )

for CURRENT in $(seq 0 ${MAX_WINDOW}); do screen -p ${CURRENT} -Q info >/dev/null 2>&1 && screen -p ${CURRENT} -X number ${NEXT} && let NEXT="${NEXT}+1" done

screen -Q select "${CURRENT_WINDOW}" >/dev/null 2>&1 screen -X msgminwait 1 screen -X msgwait 5