Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit f10a515

Browse files
authored
Gitdev bash fix1 (#8)
* small fixes shellcheck * fix sleep * Update client_latest.sh
1 parent 39e8919 commit f10a515

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

client_latest.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ echo -e " ░░░┌─┐░░░░░░░░░░░░░░░
1515
LOADING..."
1616
if [[ ! -p /tmp/chat ]]
1717
then
18-
touch /tmp/chat
19-
chmod 666 /tmp/chat
18+
touch /tmp/chat
19+
chmod 666 /tmp/chat
2020
fi
2121
echo "$USER has joined the chat" >> /tmp/chat
22-
sleep 4
22+
sleep 1
2323
clear
2424
tail -n 5 -f /tmp/chat &
2525
inpid="$!"
26-
trap "kill -15 $inpid; echo '$USER has left' >> /tmp/chat" EXIT
27-
while [ 1 ]
26+
trap 'kill -15 "$inpid"; echo "$USER has left" >> /tmp/chat' EXIT
27+
while true
2828
do
29-
read msg
30-
check=$(echo $msg | cut -c 1)
31-
if [ "$check" == "/" ]
32-
then
33-
if [ "$msg" == "/exit" ]
34-
then
35-
exit
36-
fi
37-
else
38-
time=$(date +"%T")
39-
tmsg="$USER @ $time : $msg"
40-
echo $tmsg >> /tmp/chat
41-
fi
29+
read -r msg
30+
check=$(echo "$msg" | cut -c 1)
31+
if [ "$check" == "/" ]
32+
then
33+
if [ "$msg" == "/exit" ]
34+
then
35+
exit
36+
fi
37+
else
38+
time=$(date +"%T")
39+
tmsg="$USER @ $time : $msg"
40+
echo "$tmsg" >> /tmp/chat
41+
fi
4242
done
4343
exit

0 commit comments

Comments
 (0)