Source

pcw / pcw_win.sh

Diff from to

File pcw_win.sh

 # if you don't want color, you can change the cw_color.sh part to cw etc. like the other examples
 TITLE="pcw"
 
-if ! tmux -L "$TITLE" list-sessions | grep -q "^$TITLE"; then
+if ! tmux -L "$TITLE" list-sessions 2>/dev/null | grep -q "^$TITLE:"; then
 	tmux -L "$TITLE" new-session -d -s "$TITLE" -n "$(basename "$CPATH")" "srw -p \"$(basename "$CPATH")> \" cw_color.sh -i \"$OUT\" -o \"$IN\" -n \"$NICK\""
-elif ! tmux -L "$TITLE" list-windows -t "$TITLE" | grep -q " $(basename "$CPATH") "; then
+elif ! tmux -L "$TITLE" list-windows -t "$TITLE" | grep -q " $(basename "$CPATH")[-*#!+~]\? "; then
 	tmux -L "$TITLE" new-window -d -t "$TITLE" -n "$(basename "$CPATH")" "srw -p \"$(basename "$CPATH")> \" cw_color.sh -i \"$OUT\" -o \"$IN\" -n \"$NICK\""
 fi