Created
November 3, 2011 09:32
-
-
Save bobbyjam99-zz/1336134 to your computer and use it in GitHub Desktop.
簡易チャットシェル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 同一フォルダに生成される share ファイルを | |
# $ tail -f share | |
# すれば確認できます。 | |
if [ $# -eq 0 ]; then | |
echo 'Please Input Your Name: "./chat.sh John"' | |
exit | |
fi | |
file_name=share | |
name=$1 | |
join_date=`date '+%Y/%m/%d %R'` | |
trap 'echo "***** << $name Leaving! >> *****" >> $file_name; exit 1' 1 2 3 15 | |
echo "***** << $name Joined! >> *****" >> $file_name | |
while : | |
do | |
read comment | |
com_date=`date '+%Y/%m/%d %R'` | |
echo "$com_date [$name] $comment" >> $file_name | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment