Commits

Anonymous committed 4462202

add -r to read so backslashes don't screw things up, run pcw tmux in it's own server

  • Participants
  • Parent commits a7e8606

Comments (0)

Files changed (3)

File extras/chat.sh

 
 DELAY=5 # seconds to wait when we get a "w"
 
-if ! tmux list-sessions | grep -q "^$TITLE"; then
-	tmux new-session -d -s "$TITLE"
+if ! tmux -L "$TITLE" list-sessions | grep -q "^$TITLE"; then
+	tmux -L "$TITLE" new-session -d -s "$TITLE"
 fi
 
 {
 
 done < "$SERVERS" >> "$LOG" 2>&1
 
-tmux attach-session -t "$TITLE"
+tmux -L "$TITLE" attach-session -t "$TITLE"
 
 # vim: set ts=4 sw=4 noexpandtab:

File extras/cw_color.sh

 #!/bin/bash
 
 PAD=12
-NICK=$USER
+NICK="$USER"
 
 # to find out which colors are readable...
 # for i in {0..255}; do echo $(tput setaf $i) $i foobar baz qux; done
 }
 
 cw "${IN:?no -i infile specified}" "${OUT:?no -o outfile specified}" |
-while read date time nick msg; do
+while read -r date time nick msg; do
 	nick=${nick#<}
 	nick=${nick%>}
 
 
 	first=1
 	echo "$msg" | fmt -w $((cols - head_len - 1)) -s |
-	while read line; do
+	while read -r line; do
 		line=${line//$NICK/$reset$my_nick_fmt$NICK$reset$format}
 		line=${line/#ACTION/"$action$reset$format"}
 		if [ -n "$first" ]; then
 # 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 list-sessions | grep -q "^$TITLE"; then
-	tmux new-session -d -s "$TITLE" -n "$(basename "$CPATH")" "srw -p \"$(basename "$CPATH")> \" cw_color.sh -i \"$OUT\" -o \"$IN\" -n \"$NICK\""
-elif ! tmux list-windows -t "$TITLE" | grep -q "$(basename "$CPATH")"; then
-	tmux new-window -d -t "$TITLE" -n "$(basename "$CPATH")" "srw -p \"$(basename "$CPATH")> \" cw_color.sh -i \"$OUT\" -o \"$IN\" -n \"$NICK\""
+if ! tmux -L "$TITLE" list-sessions | 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
+	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
 
 # The default command